LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

How to hide the console when we use GetKey()

hi use the GetKey(),

k=getKeY();

if(k==VAL_F1_VKEY){
----
----
}

How can hide the console when i execute this snippet....

Thanx and regards,
venki
0 Kudos
Message 1 of 3
(3,271 Views)
Hi Monky!

   I think there's no way to hide console, I mean, in GetKey docs, you'll find:

      Note
    GetKey detects keystrokes only in the Standard I/O window. GetKey does not detect keystrokes in windows
                  you create with the User Interface Library or in the console window of a Windows Console Application.


   To intercept keystroke in your panel, for example, I suggest you to use EVENT_KEYPRESS (value = 7).  For example, in your main panel callback, you can write:
  
int CVICALLBACK PanelCallback (int panel, int event, void *callbackData,
        int eventData1, int eventData2)
{
    switch (event)
       {
        case EVENT_CLOSE:
             QuitUserInterface(0);
             return 0;
            break;
           
        case EVENT_KEYPRESS:
             YourFunction( ... );
             return 0;
            break;
           
            
        }
    return 0;
}

If you look at EVENT_KEYPRESS definition, you find also this:

   #define EVENT_KEYPRESS              7   /* eventData1 = keypressed, */
                                                                    /* eventData2 = pointer to keypressed */

so you get also the value of key actually pressed.


Of course, this is valid if you have a panel, in your application. 

Hope it helps, please let me know!

graziano



0 Kudos
Message 2 of 3
(3,263 Views)
...and of course, the panel should have focus!!!
0 Kudos
Message 3 of 3
(3,261 Views)