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 know the sender is devtools or browser in Chromium_OnPreKeyEvent ?

Post Reply
coater
Posts: 187
Joined: Sat Sep 29, 2018 1:51 pm

How to know the sender is devtools or browser in Chromium_OnPreKeyEvent ?

Post by coater »

How to know the sender is devtools or browser in Chromium_OnPreKeyEvent ?
Sender.ClassName always is Tchronium.
Thank you!
coater
Posts: 187
Joined: Sat Sep 29, 2018 1:51 pm

Re: How to know the sender is devtools or browser in Chromium_OnPreKeyEvent ?

Post by coater »

I solve that by the Hokey-Pokey Technique. Is there another better solution?

GetClassName(GetParent(GetParent(GetParent(atemphandle))), @arrclass, SizeOf(arrclass)); atempStr := PChar(@arrclass); if (ansipos('Form', atempStr )>0) then PostMessage(Handle, MINIBROWSER_SHOWSEARCHFORM, TempParam, 0);


Chromium_OnPreKeyEvent, arrclass: array[0..254] of Char;
atemphandle: aMsg.hwnd or osEvent.hwnd
User avatar
salvadordf
Posts: 4564
Joined: Thu Feb 02, 2017 12:24 pm
Location: Spain
Contact:

Re: How to know the sender is devtools or browser in Chromium_OnPreKeyEvent ?

Post by salvadordf »

Compare the browser.identifier value in that event with TChromiumCore.BrowserId.
They should be different for the DevTools.
coater
Posts: 187
Joined: Sat Sep 29, 2018 1:51 pm

Re: How to know the sender is devtools or browser in Chromium_OnPreKeyEvent ?

Post by coater »

salvadordf wrote: Mon Nov 25, 2024 8:12 am Compare the browser.identifier value in that event with TChromiumCore.BrowserId.
They should be different for the DevTools.
I'll try it, thank you very much!
coater
Posts: 187
Joined: Sat Sep 29, 2018 1:51 pm

Re: How to know the sender is devtools or browser in Chromium_OnPreKeyEvent ?

Post by coater »

TMiniBrowserFrm.Chromium_OnPreKeyEvent (Sender: TObject;
const browser: ICefBrowser; const event: PCefKeyEvent;
osEvent: TCefEventHandle; out isKeyboardShortcut, Result: Boolean);

No TChromiumCore.BrowserId can be found.
User avatar
salvadordf
Posts: 4564
Joined: Thu Feb 02, 2017 12:24 pm
Location: Spain
Contact:

Re: How to know the sender is devtools or browser in Chromium_OnPreKeyEvent ?

Post by salvadordf »

Use the name of the component in your application. For example: Chromium1.BrowserId
coater
Posts: 187
Joined: Sat Sep 29, 2018 1:51 pm

Re: How to know the sender is devtools or browser in Chromium_OnPreKeyEvent ?

Post by coater »

salvadordf wrote: Wed Nov 27, 2024 2:04 pm Use the name of the component in your application. For example: Chromium1.BrowserId
But I create it for a new window. :(
Post Reply