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.
If you find these projects useful please consider becoming a sponsor with Patreon, GitHub or Liberapay.

How to get the pop-up page window handle

Post Reply
blueflagbj
Posts: 8
Joined: Mon Jul 10, 2017 8:08 am

How to get the pop-up page window handle

Post by blueflagbj »

hi,
How to get this pop-up Window handle when opening a new page window
User avatar
salvadordf
Posts: 4620
Joined: Thu Feb 02, 2017 12:24 pm
Location: Spain
Contact:

Re: How to get the pop-up page window handle

Post by salvadordf »

Try GetActiveWindow, GetForegroundWindow or EnumChildWindows.
blueflagbj
Posts: 8
Joined: Mon Jul 10, 2017 8:08 am

Re: How to get the pop-up page window handle

Post by blueflagbj »

hi,
I have found a solution like this:
var
NewBrowserHandle:hwnd;

procedure TForm1.chrm1AfterCreated(Sender: TObject; const browser: ICefBrowser);
begin
NewBrowserHandle:=browser.Host.WindowHandle;
PostMessage(Handle, BROWSER_CREATED, 0, 0);
end;

Then receive the message like this:

procedure TForm1.BrowserCreatedMsg(var aMessage : TMessage); message BROWSER_CREATED;
begin
mmo1.lines.add(inttostr(NewBrowserHandle));
end;

Is that okay?Anyway, I got the result.
User avatar
salvadordf
Posts: 4620
Joined: Thu Feb 02, 2017 12:24 pm
Location: Spain
Contact:

Re: How to get the pop-up page window handle

Post by salvadordf »

Sorry, I misunderstood.

Yes, that's correct.
Post Reply