LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

Ctrl - Alt Keypress

Hello,
 
When a key is pressed the active panel / control receives an EVENT_KEYPRESS event. In the callback function you can check which key (or combination of keys) the user has pressed. My problem is: appearently the Ctrl-Alt key combination (e.g. Ctrl-Alt-A) does NOT activate the callback function of the panel / control, so there is no EVENT_KEYPRESS event. Is there any way to take an action when the user enters this key combination?
 
All hints are more then welcom, I'm really stuck here.
Wim
0 Kudos
Message 1 of 3
(3,311 Views)
Hi,
   when you edit controls or menu objects, you have the 2 properties:

     Modifier key:

     Key: 

   You should use these property to set the shortcut to a callback.  But you'll find there's no <CTRL>-<ALT> line in Modifier key, maybe because <CTRL>-<ALT>-like shortcut are System-only available.  If so, you'd better refer to some MS developers forum!

  If you want, let me know how you solve this!

graziano
0 Kudos
Message 2 of 3
(3,305 Views)
Wim,

The <Ctrl-Alt> combination is handled in a different way by Windows, and the consequence is that it bypasses the normal EVENT_KEYPRESS mechanism used by CVI.

So accomplishing what you want is going to be difficult, but not impossible. The answer lies in you catching the underlying Windows message yourself. You can do this by chaining your own callback ahead of the callback that CVI uses for your window. If you haven't done this sort of thing before, I recommend that you examine the samples\sdk\stdio\demo.cws example. Look in particular at the InstallParentWndProc function in hwndutil.c. The main difference in your case is that you would pass it the hwnd that corresponds to your panel, which you can obtain via the ATTR_SYSTEM_WINDOW_HANDLE panel attribute.

The windows message that you are looking for is WM_KEYDOWN. You should be able to get enough information on how to interpret this message from MSDN (http://msdn.microsoft.com)

Hope this helps.

Luis
NI
Message 3 of 3
(3,286 Views)