![]() |
How to use the global key hook functionYou can use the global key hook to check the keyboard event before dispatching, by adding a hook procedure to the keyboard instance.
#include <WSDkeyboard.h> //A sample of the global key hook WSCbool keyhandler(long keycode,Boolean onoff){ // keycode : the key code (see WSkeysym.h) // onoff : True = keypress, False= key release. if (keycode == WSK_F1){ //The key code is F1... //if discard this... return False; //return the False: discard. }else if (keycode == WSK_F2){ //The key code is F2... //if dispatch this... return True; //return the True: dispatch. } return True; //return the True: dispatch. } void event_procedure(WSCbase* obj){ //the registration of the global key hook procedure. WSGIappKeyboard()->setGlobalKeyHook( keyhandler ); }keyhandler() is the procedure which grabs the key board events to do something specially. You can register it with WSGIappKeyboard()->setGlobalKeyHook(), See the header file: WSkeysym.h if you want the key codes. Document Release 1.3 For Use with Wide Studio Release 1.3, Summer 2001
|