Does anyone know the API to detect which button has been press. I need an API because, I need to click anywhere on the screen, which does not have to be on the VB Application.
Please send me a code sample.
Thanks!
Printable View
Does anyone know the API to detect which button has been press. I need an API because, I need to click anywhere on the screen, which does not have to be on the VB Application.
Please send me a code sample.
Thanks!
the SetCapture API will make windows send all mouse events to one window, ReleaseCapture sets it back to the window it's over, but whenever a mouse event is fired and code is executed the capture will be relesed.
here's the declorations
set the capture to Command1 withCode:Public Declare Function SetCapture Lib "user32" Alias "SetCapture" (ByVal hwnd As Long) As Long
Public Declare Function ReleaseCapture Lib "user32" Alias "ReleaseCapture" () As Long
Code:SetCapture Command1.hWnd
If theres no code in you're mouse move event for your command button there's no need to set the muose captiure in it again, but if there's any code in your mousemove event make sure you set the capture there as well, you also need to set the capture at the end of your click dblClick, mouseup and mousedown events to keep the messages being sent.
to release it just use
on it's own.Code:ReleaseCapture
setting the capture to a command button will cause vb to raise it's mouse events to that command button wherever the mouse is on the screen. N.B. if you set the capture to an object that is invisible it will majicly become visible.
hope this helps.
Thanks Sam!
I didn't explain myself too clear. Do you know of a way to extend the mouse_move event to all other application and then grab the handle where ever the point is residing on.
Keep in mind, I am not interest in using a timer.
You code is and will be appreciated.
Thanks
Paste tihs to a module:
----START----
Option Explicit
Type POINTAPI 'Declare types
x As Long
y As Long
End Type
Declare Function GetCursorPos Lib "user32" (lpPoint As POINTAPI) As Long 'Declare API
---END---
If you don't want to use a timer then check whenever you want. It gives you the coordinates relative to the points in screen.
Thanks for replying my friend.
But will this show me the handle as I move my pointer from application to application.
I am looking for something where, as I move my pointer, it will show the handle in a label or handle.
Yes, I am not looking to use a timer.
Thank You.