cancel mouse click on a control

Announcements and discussion for PInvoke

cancel mouse click on a control

Postby Robskew » Tue Sep 02, 2008 9:13 am

Hi everybody,

i'm creating an application using an external liberay that creates a control.If you click on this control it reacts on the mouse click, but i want to cancel this. I want to implement my own mouse click event for that control and cancel the click message to the control. Problem is that the control receives the mouse click event as first.
I tries to use wndproc to implement my own code but still the control receive the click first.

Can this be done by using a hook?
How do i implement this and then cancel the mouse event before it reaches the control??

Posts: 1
Joined: Tue Sep 02, 2008 9:11 am

Postby Robert » Tue Sep 02, 2008 9:55 am

Now, this is without having tried doing this at all, so I might be talking complete rubbish :-).

However, what you could try doing is to subclass the window handle of the control in question (see, then intercept the click messages, passing any other messages on to the original WndProc (

Hopefully that makes sense!

Robert Chipperfield
Red Gate
Posts: 418
Joined: Mon Oct 30, 2006 10:15 am
Location: Cambridge, UK

Return to PInvoke.Net

Who is online

Users browsing this forum: No registered users and 0 guests