I use CEF4Delphi ver 91, the example program MiniBrowser, to generate the executable file, but when the MiniBrowser window is closed, the program will occasionally still be running as an task manager, and the program does not completely end.
When the program loads a web page (eg: https://tw.yahoo.com/), it closes when the page has not been completed
MiniBrowser window is prone to the above phenomena.
So I want to stop the program for 0.5~1 second before calling DestroyGlobalCEFApp, which can "reduce" this situation.
Code: Select all
if (exepath.Substring(0,1).toupper='C') or (exepath.Substring(0,1).toupper='D') then begin
CreateGlobalCEFApp;
if GlobalCEFApp.StartMainProcess then
begin
Application.Initialize;
{$IFDEF DELPHI11_UP}
Application.MainFormOnTaskbar := True;
{$ENDIF}
Application.CreateForm(TMiniBrowserFrm, MiniBrowserFrm);
Application.CreateForm(TPreferencesFrm, PreferencesFrm);
Application.CreateForm(TSimpleTextViewerFrm, SimpleTextViewerFrm);
Application.CreateForm(TFindFrm, FindFrm);
Application.Run;
end;
try
//2022/10/9
TThread.Sleep(500); // sleep 0.5 second
DestroyGlobalCEFApp;
//GlobalCEFApp.Free;
except
on e : exception do begin
showmessage(e.Message);
end;
end;
end else begin
showmessage('請在c 或 D 磁碟執行本程式');
end;
why is this? THX