Home All Groups Group Topic Archive Search About

VB 2005 - How to hook into Windows to intercept all mouse events?

Author
11 Jan 2006 2:03 AM
Noozer
I'm trying to write a small application that intercepts middle clicks
anywhere in the Windows environment. I want to perform different actions,
based on the application that the mouse pointer was over at the time of the
middl click.

How does one insert a hook into Windows for a VB 2005 to act on system mouse
clicks?

Thx

Author
11 Jan 2006 2:10 AM
Ken Tucker [MVP]
Hi,

http://msdn.microsoft.com/msdnmag/issues/02/10/CuttingEdge/

Ken
-------------
"Noozer" <dont.spam@me.here> wrote in message
news:0IZwf.292139$ki.82383@pd7tw2no...
Show quoteHide quote
> I'm trying to write a small application that intercepts middle clicks
> anywhere in the Windows environment. I want to perform different actions,
> based on the application that the mouse pointer was over at the time of
> the middl click.
>
> How does one insert a hook into Windows for a VB 2005 to act on system
> mouse clicks?
>
> Thx
>
Author
11 Jan 2006 7:17 AM
Noozer
"Ken Tucker [MVP]" <vb***@bellsouth.net> wrote in message
news:ulZl5QlFGHA.3984@TK2MSFTNGP14.phx.gbl...
> Hi,
>
> http://msdn.microsoft.com/msdnmag/issues/02/10/CuttingEdge/


So it's impossible to do a global hook then? I don't read C too well.
Author
11 Jan 2006 11:57 AM
Ken Tucker [MVP]
Hi,

        No it is possible.  The samples there are c# which convert easily to
vb.net.

Here is an example of a windows hook that notifies you when a device is
plugged in to the usb port.

http://www.vb-tips.com/default.aspx?ID=e6f103d1-1c0d-4d89-a2a0-f3826480a706

Ken
---------------------
"Noozer" <dont.spam@me.here> wrote in message
news:gi2xf.294938$ki.131402@pd7tw2no...
Show quoteHide quote
>
> "Ken Tucker [MVP]" <vb***@bellsouth.net> wrote in message
> news:ulZl5QlFGHA.3984@TK2MSFTNGP14.phx.gbl...
>> Hi,
>>
>> http://msdn.microsoft.com/msdnmag/issues/02/10/CuttingEdge/
>
>
> So it's impossible to do a global hook then? I don't read C too well.
>
Author
11 Jan 2006 10:03 PM
Noozer
Thanks Ken!

It's appreciated!


Show quoteHide quote
"Ken Tucker [MVP]" <vb***@bellsouth.net> wrote in message
news:%23m7WpYqFGHA.3200@tk2msftngp13.phx.gbl...
> Hi,
>
>        No it is possible.  The samples there are c# which convert easily
> to vb.net.
>
> Here is an example of a windows hook that notifies you when a device is
> plugged in to the usb port.
>
> http://www.vb-tips.com/default.aspx?ID=e6f103d1-1c0d-4d89-a2a0-f3826480a706
>
> Ken
> ---------------------
> "Noozer" <dont.spam@me.here> wrote in message
> news:gi2xf.294938$ki.131402@pd7tw2no...
>>
>> "Ken Tucker [MVP]" <vb***@bellsouth.net> wrote in message
>> news:ulZl5QlFGHA.3984@TK2MSFTNGP14.phx.gbl...
>>> Hi,
>>>
>>> http://msdn.microsoft.com/msdnmag/issues/02/10/CuttingEdge/
>>
>>
>> So it's impossible to do a global hook then? I don't read C too well.
>>
>
>
Author
12 Jan 2006 1:16 PM
Colin Neller
Noozer,

In addition, I have a VB.NET example of hooking mouse (and keyboard) events
on my blog:
http://www.colinneller.com/blog/PermaLink,guid,2838f59a-f4af-4c95-a322-b9ee5918a39c.aspx

"Noozer" <dont.spam@me.here> wrote in message
news:xgfxf.305760$ki.30154@pd7tw2no...
Show quoteHide quote
> Thanks Ken!
>
> It's appreciated!
>
>
> "Ken Tucker [MVP]" <vb***@bellsouth.net> wrote in message
> news:%23m7WpYqFGHA.3200@tk2msftngp13.phx.gbl...
>> Hi,
>>
>>        No it is possible.  The samples there are c# which convert easily
>> to vb.net.
>>
>> Here is an example of a windows hook that notifies you when a device is
>> plugged in to the usb port.
>>
>> http://www.vb-tips.com/default.aspx?ID=e6f103d1-1c0d-4d89-a2a0-f3826480a706
>>
>> Ken
>> ---------------------
>> "Noozer" <dont.spam@me.here> wrote in message
>> news:gi2xf.294938$ki.131402@pd7tw2no...
>>>
>>> "Ken Tucker [MVP]" <vb***@bellsouth.net> wrote in message
>>> news:ulZl5QlFGHA.3984@TK2MSFTNGP14.phx.gbl...
>>>> Hi,
>>>>
>>>> http://msdn.microsoft.com/msdnmag/issues/02/10/CuttingEdge/
>>>
>>>
>>> So it's impossible to do a global hook then? I don't read C too well.
>>>
>>
>>
>
>