Page 3 of 3

Re: SetKey with ALT key doesn't work

PostPosted: Wed Feb 01, 2012 7:17 am
by frose
Hunter,

yes, see above:
Antonio wrote:
The "special" keys: Ctrl, Shift and Alt, can't be intercepted using SetKey().

For Shift and Ctrl you can use:

GetKeyState( VK_SHIFT ) --> lYesOrNo

GetKeyState( VK_CONTROL ) --> lYesOrNo

Alt is a system key and usually gets routed through the Method SysCommand(). Windows uses Alt for some system actions, so its better not to use it. In some cases we can redefine a Method SysCommand() to trap the System Alt+Key that we need to intercept. In example, Windows uses Alt+F4 to close the app.

Non system used Alt+... combinations are usually reserved for menuitems actions, and hotkey accelerators.

So, for Alt+... combinations, you have to implement something like:
Code: Select all  Expand view
@  5,  4 BUTTON "Alt-&C - Quit" OF oDlg SIZE 40, 12 ACTION TheEnd()