latest version in Delphi and Lazarus issue
Posted: Fri Aug 17, 2018 5:36 pm
Hi,
I ported my old app from Delphi 2009 to Lazarus but I am having a issue with a embedded component that shows a image thumbnail and when the user clicks the thumbnail it uses shellexecute in the embedded control to view the image.
The problem is when I do this it corrupts all the menus in my application.
It also does it in the latest Delphi community edition.
The embedded control is from one of your examples and is called imagebutton.pas
If I remove the shellexecute it does not corrupt the menus.
I ported my old app from Delphi 2009 to Lazarus but I am having a issue with a embedded component that shows a image thumbnail and when the user clicks the thumbnail it uses shellexecute in the embedded control to view the image.
The problem is when I do this it corrupts all the menus in my application.
It also does it in the latest Delphi community edition.
The embedded control is from one of your examples and is called imagebutton.pas
If I remove the shellexecute it does not corrupt the menus.
Code: Select all
procedure TImgButton.open;
var
tpath,fpath:string;
outstream:tmemorystream;
begin
//Save the file to temp directory and use shell execute to open it.
tpath:=GetTempPath;
fpath:= format('%s%s',[tpath,ffile_name]);
outstream:=tmemorystream.Create;
try
try
fstream.Position:=0;
ZDecompressStream(fstream,outstream);
outstream.Position:=0;
outstream.SaveToFile(fpath);
ShellExecute(0, nil, pchar(fpath), nil, nil, SW_SHOWNORMAL);
except
on e:EZDecompressionError do
raise exception.Create('TFileButton.open zlib error:'+e.Message);
on e:Exception do
raise;
end;
finally
outstream.Free;
end;
end;