LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

Detection of the control Key down when application start

I need to detect if the control key is down when my program start. This program was created with CVI 5.0. Would you tell me how to do it under WIN 9x et NT/2000. Regards
0 Kudos
Message 1 of 3
(3,028 Views)
Normally, for any other key you could just set up a callback function for your panel and set up a case statement for the EVENT_KEYPRESS value for the event type. Or do the same on the initial control that has focus. However, this does not work for the control key, because it does not generate an EVENT_KEYPRESS. Therefore, giving you no option through the normal CVI user interface capabilities.

Now, you might be able to detect the keypress through windows messaging if you use the function InstallWinMsgCallback found in the Programmer's Toolbox library (toolbox.fp in cvi\toolslib\toolbox) and set up a callback function to look for the message that the control key generates for a window. Other than that, you might have to use some Windows SDK functions, that wait for a keypr
ess to happen.

Jason Foster
Applications Engineer
National Instruments
www.ni.com/ask
0 Kudos
Message 2 of 3
(3,028 Views)
Use the GetGlobalMouseState function (User Interface library/Mouse and Cursor Class).
It returns the mouse status (position
and buttons) and the shift/ctrl key status.
0 Kudos
Message 3 of 3
(3,028 Views)