Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Capturing ALT key press
Message
From
06/09/2005 12:26:24
Gary Foster
Pointsource Consulting LLC
Chanhassen, Minnesota, United States
 
 
To
All
General information
Forum:
Visual FoxPro
Category:
Windows API functions
Title:
Capturing ALT key press
Environment versions
Visual FoxPro:
VFP 7
Miscellaneous
Thread ID:
01047059
Message ID:
01047059
Views:
70
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')
Next
Reply
Map
View

Click here to load this message in the networking platform