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.

Handle select

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

Re: Handle select

Post by salvadordf »

Hi,

If you use "WinExplorer" or some other utility to show all system windows you will see that if you click on a SELECT element CEF3 will create a window called Chrome_WidgetWin_0 with a child window called Chrome_RenderWidgetHostHWND. These windows are not children from the CEF4Delphi browser (SimpleBrowser2 in this case) and they are different from the windows with the same name created by CEF3 as children of the CEF4Delphi browser.
  • Chrome_WidgetWin_0
    • Chrome_RenderWidgetHostHWND
  • SimpleBrowser2
    • TCEFWindowParent
      • CefBrowserWindow
        • Chrome_WidgetWin_0
          • Chrome_RenderWidgetHostHWND
TChromium uses FindWindowEx in the TChromium.doOnRenderViewReady procedure to find the child windows Chrome_WidgetWin_0 and Chrome_RenderWidgetHostHWND. The HWNDs are copied in TChromium.WidgetHandle and TChromium.RenderHandle.

What you ask is a way to get the HWNDs of the other (not the browser children) Chrome_WidgetWin_0 and Chrome_RenderWidgetHostHWND windows. To get them you will have to use the FindWindow function to get the Chrome_WidgetWin_0 THandle and then use FindWindowEx to get the Chrome_RenderWidgetHostHWND THandle :
https://msdn.microsoft.com/en-us/librar ... s.85).aspx
https://msdn.microsoft.com/en-us/librar ... s.85).aspx

Code: Select all

var
  TempWidgetHandle, TempRenderHandle : THandle;
begin
  TempWidgetHandle := FindWindow('Chrome_WidgetWin_0', '');

  if (TempWidgetHandle <> 0) then
    TempRenderHandle := FindWindowEx(TempWidgetHandle, 0, 'Chrome_RenderWidgetHostHWND', 'Chrome Legacy Window');
end;      
PS : WinExplorer can be downloaded from http://www.nirsoft.net/utils/winexp.html
Post Reply