I have a dilema with my DCEF3 (using Delphi XE3). Let's simply take the cefclient.exe from demo package, since it's not using forms and I didn't really found too much documentation on google, how could I check if there's any process so it can focus the current opened one instead opening a new one.
This is what I'm using in the guiclient demo, where I am using Forms unit.
begin
Hwnd := FindWindow ('TLoginForm', nil);
if Hwnd = 0 then
begin
Application.Initialize;
Application.Title := 'Tribul.Net - Game Overview';
Application.CreateForm(TLoginForm, LoginForm);
Application.CreateForm(TBrowserForm, BrowserForm);
Application.Run;
end else
SetForegroundWindow(Hwnd);
end.
Any idea on how to do this on this sample of code?
// multi process
CefSingleProcess := False;
if not CefLoadLibDefault then Exit;
try
wndClass.style := CS_HREDRAW or CS_VREDRAW;
wndClass.lpfnWndProc := @CefWndProc;
wndClass.cbClsExtra := 0;
wndClass.cbWndExtra := 0;
wndClass.hInstance := hInstance;
wndClass.hIcon := LoadIcon(0, IDI_APPLICATION);
wndClass.hCursor := LoadCursor(0, IDC_ARROW);
wndClass.hbrBackground := 0;
wndClass.lpszMenuName := nil;
wndClass.lpszClassName := 'tribul';
RegisterClass(wndClass);
Window := CreateWindow(
'tribul', // window class name
'Tribul.net - Gods of War', // window caption
WS_OVERLAPPEDWINDOW or WS_CLIPCHILDREN, // window style
Integer(CW_USEDEFAULT), // initial x position
Integer(CW_USEDEFAULT), // initial y position
Integer(CW_USEDEFAULT), // initial x size
Integer(CW_USEDEFAULT), // initial y size
0, // parent window handle
0, // window menu handle
hInstance, // program instance handle
nil); // creation parameters
ShowWindow(Window, SW_SHOW);
UpdateWindow(Window);