Disclosure Statement: This site contains affiliate links, which means that I may receive a commission if you make a purchase using these links. As an eBay Partner, I earn from qualifying purchases.

How to create and destroy browser form?

User avatar
salvadordf
Posts: 4016
Joined: Thu Feb 02, 2017 12:24 pm
Location: Spain
Contact:

Re: How to create and destroy browser form?

Post by salvadordf »

It's been a long time since the last time I took a look at the source code of the DCEF3 project.

It should be possible but you will have to "translate" what you see in the ToolboxBrowser demo.
As you can see, the CEF initialization and finalization steps are different.
andreykrasnodar
Posts: 112
Joined: Wed Jul 01, 2020 10:22 am

Re: How to create and destroy browser form?

Post by andreykrasnodar »

Thanks for the link
andreykrasnodar
Posts: 112
Joined: Wed Jul 01, 2020 10:22 am

Re: How to create and destroy browser form?

Post by andreykrasnodar »

I have installed old cef 4 version, but my project could not compiled.

Code: Select all

Chromium1.Browser.Host.SendMouseClickEvent(@MouseCoord, MBT_LEFT, false, 1);
[dcc32 Error] Unit1.pas(348): E2010 Incompatible types: 'uCEFTypes.TCefMouseButtonType' and 'ceflib.TCefMouseButtonType'
User avatar
salvadordf
Posts: 4016
Joined: Thu Feb 02, 2017 12:24 pm
Location: Spain
Contact:

Re: How to create and destroy browser form?

Post by salvadordf »

The DCEF3, CEF4Delphi and OldCEF4Delphi projects share many class names, data type names, event names, etc.

If you work with one of them then you will have to uninstall the rest and remove the other projects from the library path.

The error you have is caused by this and you will have to uninstall DCEF3 before you install OldCEF4Delphi.
andreykrasnodar
Posts: 112
Joined: Wed Jul 01, 2020 10:22 am

Re: How to create and destroy browser form?

Post by andreykrasnodar »

ok, i did it. I have uninstalled both and installed CEF4 OLD.
But there are new problems. It is really hard to remake project written on cef3 to cef4. No ceflib here and problems begins with string

Code: Select all

var   CookieManager: iCefCookieManager; 
because no iCefCookieManager in this version.

Maybe anybody knows how to create and destroy form containing Chromium in cef3.
andreykrasnodar
Posts: 112
Joined: Wed Jul 01, 2020 10:22 am

Re: How to create and destroy browser form?

Post by andreykrasnodar »

Anybody please help me
User avatar
salvadordf
Posts: 4016
Joined: Thu Feb 02, 2017 12:24 pm
Location: Spain
Contact:

Re: How to create and destroy browser form?

Post by salvadordf »

The CookieVisitor demo in OldCEF4Delphi has all the code to get and set the cookies.
andreykrasnodar
Posts: 112
Joined: Wed Jul 01, 2020 10:22 am

Re: How to create and destroy browser form?

Post by andreykrasnodar »

CEF3 also creates global application which I can not terminate after closing form.
Everything is ok and no need to rewrite project using CEF 4, but I only need analog of GlobalCEFApp.Free for CEF3.
andreykrasnodar
Posts: 112
Joined: Wed Jul 01, 2020 10:22 am

Re: How to create and destroy browser form?

Post by andreykrasnodar »

I have found function CEFShutDown. Hope it will help.

Code: Select all

  // This function should be called on the main application thread to shut down
  // the CEF browser process before the application exits.
  cef_shutdown: procedure(); {$IFDEF CPUX64}stdcall{$ELSE}cdecl{$ENDIF};
andreykrasnodar
Posts: 112
Joined: Wed Jul 01, 2020 10:22 am

Re: How to create and destroy browser form?

Post by andreykrasnodar »

I am trying to do this

Code: Select all

procedure TForm1.FormClose(Sender: TObject; var Action: TCloseAction);
begin
  CefShutdown();
end;
but nothing happened: the process is still in the task manager after closing main form
Post Reply