Local Mouse Hook problem

J

Johnny J.

I want to intercept mouse events in my application and in certain cases
cancel them. I used the code from CodeProject to implement a mouse hook:

http://www.codeproject.com/csharp/netwin32hooks.asp

(the above code is in C#, but my program is in VB! so this is the right
newsgroup, thank you...)

It works perfectly, and I can intercept the mouse events I want. However, it
doesn't seem like there is no way of cancelling the events (or e.g. setting
handled = true).

Has anybody got experience with that?

Cheers,
Johnny J.
 
M

Mattias Sjögren

It works perfectly, and I can intercept the mouse events I want. However, it
doesn't seem like there is no way of cancelling the events (or e.g. setting
handled = true).

Has anybody got experience with that?

You have a WH_MOUSE hook? If so you can skip calling CallNextHookEx
and return nonzero from your hook procedure to prevent the default
message processing, as long as nCode >= 0.


Mattias
 
J

Johnny J.

Tack så mycket Mattias - Det var precis det jag ville veta - nu funkar allt
perfekt.

Vänliga hälsningar,
Johnny¨
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top