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.

OSR browser in TThread - multi-process issues

Post Reply
demonslord
Posts: 3
Joined: Thu Mar 18, 2021 10:30 am

OSR browser in TThread - multi-process issues

Post by demonslord »

Hi salvadordf,
I've some problems with attaching the OSR browser, which run in TThread (like in your WebpageSnapshot demo).
In main app, I've shortcut to call the TForm with TCEFWindowParent in tabsheet, this form is for debug purpose because have automation actions which load/parse and return the data, and want see/debug in "live" mode.

I've tried to set the parent, but without success:

Code: Select all

ChromiumThread.Chromium.SetNewBrowserParent(CEFWindowParent1.Handle);
Maybe be I'm mising something or it's not possible attach "on-demand"?

Also, when i trigger the takesnapshot, sometimes (most when GlobalCEFApp.SingleProcess is False (by default)) snapshot is just blank(white), but if I open the DevConsole, I can see the page is loaded...

Can you provide some tips?

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

Re: OSR browser in TThread - multi-process issues

Post by salvadordf »

Hi,

Browsers using the OSR mode don't use the TCEFWindowParent component. TCEFWindowParent is used for browsers in "normal" mode which need a parent control used by CEF to create child controls which are used to show the web contents.

Code: Select all

TForm -> TCEFWindowParent -> (controls created by CEF)
In normal mode you can reparent the browser if you need to show a web page in a different TCEFWindowParent control.

However, in OSR mode CEF doesn't create any control to show the web contents. In this case you use a TBufferPanel or TFMXBufferPanel component which are a custom canvas where your application copies the raw bitmap information given by the browser to paint the web contents.

If you need to show the web contents from an OSR browser in another place you only have to copy the raw bitmap information in the new component.

The TChromium.SetNewBrowserParent procedure is not intended for OSR browsers.
demonslord
Posts: 3
Joined: Thu Mar 18, 2021 10:30 am

Re: OSR browser in TThread - multi-process issues

Post by demonslord »

Hi salvadordf,

Thanks for reply! Got it!
If you need to show the web contents from an OSR browser in another place you only have to copy the raw bitmap information in the new component.
Yes, I do that like in your WebpageSnapshot demo, but the problem is sometimes it's just blank, in most of cases, it happens with multiple processes, and can't debug in this way..

Maybe it's something with threads?
User avatar
salvadordf
Posts: 4016
Joined: Thu Feb 02, 2017 12:24 pm
Location: Spain
Contact:

Re: OSR browser in TThread - multi-process issues

Post by salvadordf »

I would suggest that you try using a visible browser first.

You could try a MDI app similar to the MDIBrowser demo but replacing the browsers in the child forms for browsers in OSR mode.

The white screens could be caused by several things that should be much easier to debug in a MDI app.
Post Reply