473,394 Members | 1,178 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,394 software developers and data experts.

Mouse Event

Is there a way to receive a message any time the mouse is clicked
anywhere on the screen? I would be kind of like a clicke event handler
for the entire screen.

Jan 5 '06 #1
2 1549
Use SetWindowsHookEx:

<DllImport("user32.dll")> _
Public Shared Function SetWindowsHookEx( _
ByVal idHook As Integer, _
ByVal lpfn As HookProc, _
ByVal hInstance As IntPtr, _
ByVal threadId As Integer) As Integer
End Function

<DllImport("user32.dll")> _
Public Shared Function UnhookWindowsHookEx(ByVal idHook As Integer) As
Boolean
End Function

<DllImport("user32.dll")> _
Public Shared Function CallNextHookEx( _
ByVal idHook As Integer, _
ByVal nCode As Integer, _
ByVal wParam As Integer, _
ByVal lParam As IntPtr) As Integer
End Function

--
Colin Neller
http://www.colinneller.com/blog
"Dave" <dc*****@gmail.com> wrote in message
news:11**********************@g43g2000cwa.googlegr oups.com...
Is there a way to receive a message any time the mouse is clicked
anywhere on the screen? I would be kind of like a clicke event handler
for the entire screen.

Jan 5 '06 #2
Unfortunately this is not what the OP is looking for. Please read his other
postings; subject 'Monitor'..
Dave, please don't start multiple threads about the same issue, I replied to
your latest posting titled 'Monitor'.

Willy.

"Colin Neller" <cn*****@gmail.com> wrote in message
news:eo**************@TK2MSFTNGP15.phx.gbl...
Use SetWindowsHookEx:

<DllImport("user32.dll")> _
Public Shared Function SetWindowsHookEx( _
ByVal idHook As Integer, _
ByVal lpfn As HookProc, _
ByVal hInstance As IntPtr, _
ByVal threadId As Integer) As Integer
End Function

<DllImport("user32.dll")> _
Public Shared Function UnhookWindowsHookEx(ByVal idHook As Integer) As
Boolean
End Function

<DllImport("user32.dll")> _
Public Shared Function CallNextHookEx( _
ByVal idHook As Integer, _
ByVal nCode As Integer, _
ByVal wParam As Integer, _
ByVal lParam As IntPtr) As Integer
End Function

--
Colin Neller
http://www.colinneller.com/blog
"Dave" <dc*****@gmail.com> wrote in message
news:11**********************@g43g2000cwa.googlegr oups.com...
Is there a way to receive a message any time the mouse is clicked
anywhere on the screen? I would be kind of like a clicke event handler
for the entire screen.


Jan 5 '06 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
by: John Champaign | last post by:
Hi all, I'm working on an educational applet for a child with special needs. He's got a bit of a trick to make my life more difficult... To interact with the applet he needs to click on...
9
by: punkin | last post by:
I am trying to catch mouse position on the entire screen by dynamically generating mouse click event at every 100 ms. My code only works for IEs but not any Netscape or Gecko-based browsers. The...
5
by: gsb | last post by:
I track the mouse location like this code: function mousePos(e) { var p = new Object(); if(e) { p.x = e.pageX; p.y = e.pageY; } else { p.x = event.x; p.y = event.y; } ... (show) }...
3
by: mitsura | last post by:
Hi, I have included a small listing. The test program opens a panel and show a bitmap. What I want is to when the mouse is over the bitmap panel, I want to trap the left mouse click. The...
1
by: Jay | last post by:
I need to be able to move a Panel on a windows Form at run time using the mouse. I have tried adding a MouseDown event handler to the Panel and then within the MouseDown handler adding a MouseMove...
3
by: Logan Mckinley | last post by:
I need to be able to detect mouse movement even when it is not over my application. I can get the mouse cords using MousePosition but I am not sure if there is an event that hits my program when...
0
by: lechatthierry | last post by:
Is it possible to block a mouse event on an Hyperlink with a general script event? This is quite troublesome for me. I am trying to find a way to block the windows shortcut SHIFT + MOUSE LEFT...
1
by: Neko | last post by:
Is it possible to block a mouse event on an Hyperlink with a general script event? This is quite troublesome for me. I am trying to find a way to block the windows shortcut SHIFT + MOUSE LEFT...
3
by: wanwan | last post by:
I made a game with a window form that needs to record the mouse position to an array at 100 samples per second, so I use the mouse move event to do the job. The problem is the mouse move event...
2
by: markszlazak | last post by:
In the following script, a control displays (black box) in each table cell once you mouse over the cell. Mouse down on the control to change the mode of the table. Drag the mouse over cells in the...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.