LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

Invisible app + hot keys recall ?

Sorry if I miss something in CVI or this forum but I want my app
completly invisible and recalled by a hot key sequence (ie.

I succeed in the invisibilty: no panel, no taskbar, no icon at all...
The side effect is of course that I can not recall my app!! I would like
it to be recalled by a sequence of key, but didn't succeed in the way to
implement this...
Any help?

Thanks.
--Fred.
0 Kudos
Message 1 of 3
(2,901 Views)
You can catch keypress events in CVI. For example, install a callback for the panel you want to display by pressing the hotkeys. Inside the callback, test for the EVENT_KEYPRESS event. You can use the GetKeypressEventModifiers and the GetKeypressEventCharacter functions inside the callback to get the modifier and character keys pressed. However, only one modifier key and one characer key is supported. For example, you can catch the keypress "M" and "ALT + M" but not "CTRL + ALT + M". CVI claims support for the "CTRL + SHIFT" modifier but I couldn't get it to work.

Additionally, with this method, you have no information about the sequence of keys pressed. My recommendation is to implement a hot key sequence using only one modifier such as "ALT + A + B + C". I
n this way, three keypress events will be generated as "ALT + A", "ALT + B", "ALT + C". For the first event, you can set a flag. For the second event, you test this flag. If this has been set, you know that key #1 has been hit and set the second event flag, and so on... The code below shows what I'm talking about. Hope this helps. If you find a more graceful solution, let me know.

switch (event) {
case EVENT_KEYPRESS:
character = GetKeyPressEventModifiers (eventData2);
//VAL_UNDERLINE_MODIFIER == "ALT"
//you can also use VAL_MENUKEY_MODIFIER which is "CTRL"
if (character == (VAL_UNDERLINE_MODIFIER)) {
character = GetKeyPressEventCharacter (eventData2);
if (character == 'A') {
ClearFlags ();
Key1 = 1;
}
if (character == 'B') {
if (Key1 == 1) {
Key2 == 1;
}
else {
ClearFlags ();
}
}
//the rest of the sequences here
break;
}
Message 2 of 3
(2,901 Views)
You're right and I understand your method, but the keypress event is
received only by the panel, ie only if my panel is the active one.
But I want my app to "wake up" at any time when a hotkey sequence is
pressed, just as the sequence wake up the task manager.

bthorp a �crit :

> You can catch keypress events in CVI. For example, install a callback
> for the panel you want to display by pressing the hotkeys. Inside the
> callback, test for the EVENT_KEYPRESS event. You can use the
> GetKeypressEventModifiers and the GetKeypressEventCharacter functions
> inside the callback to get the modifier and character keys pressed.
> However, only one modifier key and one characer key is supported. For
> example, you can catch the keypress "M" and "ALT + M" but not "CTRL +
> ALT + M". CVI claims support for the "CTRL + SHIFT" modifier but I
> couldn't get it to work.
>
> Additionally, with this method, you have no information about the
> sequence of keys pressed. My recommendation is to implement a hot key
> sequence using only one modifier such as "ALT + A + B + C". In this
> way, three keypress events will be generated as "ALT + A", "ALT + B",
> "ALT + C". For the first event, you can set a flag. For the second
> event, you test this flag. If this has been set, you know that key #1
> has been hit and set the second event flag, and so on... The code
> below shows what I'm talking about. Hope this helps. If you find a
> more graceful solution, let me know.
>
> switch (event) {
> case EVENT_KEYPRESS:
> character = GetKeyPressEventModifiers (eventData2);
> //VAL_UNDERLINE_MODIFIER == "ALT"
> //you can also use VAL_MENUKEY_MODIFIER which is "CTRL"
> if (character == (VAL_UNDERLINE_MODIFIER)) {
> character = GetKeyPressEventCharacter (eventData2);
> if (character == 'A') {
> ClearFlags ();
> Key1 = 1;
> }
> if (character == 'B') {
> if (Key1 == 1) {
> Key2 == 1;
> }
> else {
> ClearFlags ();
> }
> }
> //the rest of the sequences here
> break;
> }

--
F. Maillet - Sodatec Toulouse
Responsable Qualit� Projets
0 Kudos
Message 3 of 3
(2,901 Views)