Information générale
Catégorie:
Fonctions Windows API
Titre:
Capturing ALT key press
Versions des environnements
Hi all,
I’m trying to capture some ALT key combinations. Since KeyPress ignores ALT key combos, I took some code from here, modified it and put it in a form base class method.
It works in *most* of my forms, but not all. For some reason, certain forms seem to ignore the alt key up event. AEVENT() shows the proper binding, LIST DLLS shows CallWindowProc declared, ShowWindow() run from another instance of VFP maximizes, minimizes the form using it's hWnd so that’s ok. Everything seems the same for forms that work and forms that don’t.
Since there’s no way for y’all to know what’s going on inside my framework, I’m wondering if any general guidance suggests itself in using these API calls or perhaps another way to capture the alt keys I need. I have modal forms and spent quite a while trying to get a menu to intercept the keys. That also works *most* of the time but I need real reliability for my users.
Thanks.
LPARAMETERS toForm
#DEFINE WM_KEYDOWN 0x0100
#DEFINE WM_KEYUP 0x0101
#DEFINE GWL_WNDPROC -4
#define WM_SYSKEYDOWN 0x0104
#define WM_SYSKEYUP 0x0105
DECLARE LONG GetWindowLong IN user32.dll LONG, INTEGER nIndex
DECLARE integer CallWindowProc IN user32.dll integer lpPrevWndFunc,LONG , integer Msg ,integer wParam ,integer lParam
toForm.WndProc = GetWindowLong(toForm.hWnd,GWL_WNDPROC)
CLEAR DLLS "GetWindowLong"
BINDEVENT(toForm.hWnd, WM_SYSKEYUP, toForm, 'AltKeyPress')
Suivant
Répondre
Voir le fil de ce thread
Voir le fil de ce thread à partir de ce message seulement
Voir tous les messages de ce thread
Voir tous les messages de ce thread à partir de ce message seulement