I am using CEF4Delphi and receiving the error "Invalid window handle" in StartMainProcess and Free of the object GlobalCEFApp. Is there anything that could cause this error? Below, the code snippet where the process is make (in .dpr file):
Code: Select all
if DirectoryExists(extractFilePath(ParamStr(0)) + 'cef') then
begin
try
RemoveDir(extractFilePath(ParamStr(0)) + 'cef\cache\Cache');
if not assigned(GlobalCEFApp) then
GlobalCEFApp := TCefApplication.Create;
GlobalCEFApp.FrameworkDirPath := extractFilePath(ParamStr(0)) + 'cef';
GlobalCEFApp.ResourcesDirPath := extractFilePath(ParamStr(0)) + 'cef';
GlobalCEFApp.LocalesDirPath := extractFilePath(ParamStr(0)) + 'cef\locales';
GlobalCEFApp.cache := extractFilePath(ParamStr(0)) + 'cef\cache';
GlobalCEFApp.UserDataPath := extractFilePath(ParamStr(0)) + 'cef\UserData';
if not GlobalCEFApp.StartMainProcess then
raise Exception.Create('');
except
{ raise Exception.Create('Erro ao iniciar processo de CEF'); }
end;
end;
Application.Initialize;
Application.MainFormOnTaskbar := True;
Application.CreateForm(TdmComunicacao, dmComunicacao);
Application.CreateForm(TfrmPrincipal, frmPrincipal);
Application.Run;
if Assigned(GlobalCEFApp) then
GlobalCEFApp.Free;