10-12-2011 07:52 AM
Hello,
Does someone could help me to know where the mouse is clicked in non labview window
i started using user32.dll
i can indicate which window i want to use, i can swith to it, now i 'm little stuck with which function to use
to detect where i click (left but) the mouse on this window
i need to recover cordinates + left down butt event to start another vi from this point
an idea ?
Tinnitus
10-12-2011 08:35 AM
You said you started using user32.dll. How far did you get? What you are looking to do basically involves using global hooks via the Windows API. For this, you'd need to write your own DLL to handle the callbacks. If you Google you should be able to find examples.
10-12-2011 08:37 AM
So,
Labview has input functions (see 'initialize mouse' and 'acquire input data'). These can get you the state of the mouse if you loop over them continuously, regardless of where the mouse is or over what window the mouse is operating.
I don't think you have access to the messages generated by the mouse directly though, as those are normally only shared with the window over which the event occurs. I'm not sure going into the windows api gets you more information than what is available with the labview input functions.
Of course, if you have total control over the non-labview window (i.e you are writing the code for it), then you can handle the mouse events in that window. See the windows mouse api and specifically handling mouse messages in the windows procedure function.
http://msdn.microsoft.com/en-us/library/windows/desktop/ms645533(v=VS.85).aspx
10-12-2011 08:47 AM
@majoris wrote:
So,
Labview has input functions (see 'initialize mouse' and 'acquire input data'). These can get you the state of the mouse if you loop over them continuously, regardless of where the mouse is or over what window the mouse is operating.
Oh, yeah. Keep forgetting about those. My brain has developed a leak. Thanks for the reminder.
10-12-2011 10:30 AM
Hello,
yes i know about the mouse input palette but is not sufficient to do what i need
i see that i have to use user32.dll functions but which ones
i heard about SetWindowsHookEx ...
Regards
Tinnitus
10-12-2011 12:34 PM
The input functions give you the corrdinates + mouse button state which what you said you wanted. I assume there is an additional requirement you didn't mention?
10-12-2011 01:24 PM
Hello,
yes, i just tried on my home computer i don't know why button status was not visible on my office pc
i will check tomorrow.
A thing , here we are forced to use a polling method , i would have prefered to record left click as an event
Regards
Tinnitus
10-12-2011 02:07 PM
For events you would need to deal with callbacks from the Windows API. For this you will need to create a wrapper DLL. I'd suggest taking a look at the examples in the Windows Message Queue Library. That library contains source code for the DLL that you can take a look at.