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.

Get the WM_XBUTTONDOWN message in Chromium

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

Re: Get the WM_XBUTTONDOWN message in Chromium

Post by salvadordf »

Try the TChromium.OnRenderCompMsg event and set aHandled to TRUE for the WM_XBUTTONDOWN message.

The TChromium.OnRenderCompMsg event has a known bug and it stops working after the second TChromium.LoadURL call.

If TChromium.OnRenderCompMsg works the first time and your application needs to load several URLs try using TChromium.RenderCompHWND with SetWindowLongPtr to use a custom procedure to intercept the WM_XBUTTONDOWN message.
User avatar
salvadordf
Posts: 4016
Joined: Thu Feb 02, 2017 12:24 pm
Location: Spain
Contact:

Re: Get the WM_XBUTTONDOWN message in Chromium

Post by salvadordf »

I don't have one of those mice with navigation buttons but I would try the TChromium.OnPreKeyEvent and TChromium.OnKeyEvent.
Perhaps those buttons trigger a key event that you can intercept in those events.
User avatar
salvadordf
Posts: 4016
Joined: Thu Feb 02, 2017 12:24 pm
Location: Spain
Contact:

Re: Get the WM_XBUTTONDOWN message in Chromium

Post by salvadordf »

Sorry, I forgot to add that you have to set aMessage.Result too.

I'm not sure if all the Windows message set aMessage.Result as a boolean and I shouldn't set it in the TChromium's code.

In the case of WM_XBUTTONDOWN try setting :

Code: Select all

aHandled := True;
aMessage.Result := LRESULT(True);
User avatar
salvadordf
Posts: 4016
Joined: Thu Feb 02, 2017 12:24 pm
Location: Spain
Contact:

Re: Get the WM_XBUTTONDOWN message in Chromium

Post by salvadordf »

Try setting a boolean variable to true when TChromium.OnRenderCompMsg receives a WM_XBUTTONDOWN message and then use the TChromium.OnBeforeBrowse event to cancel the navigation if the previous boolean variable was true.
https://www.briskbard.com/forum/viewtopic.php?f=8&t=700

If that fails, you can also use a low level mouse hook with SetWindowsHookEx and WH_MOUSE_LL to intercept any mouse message.
Post Reply