FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin for Harbour/xHarbour SetKey with ALT key doesn't work
Posts: 392
Joined: Tue Mar 10, 2009 11:54 AM
Re: SetKey with ALT key doesn't work
Posted: Wed Feb 01, 2012 07:17 AM
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 (fw): Select all Collapse
@  5,  4 BUTTON "Alt-&C - Quit" OF oDlg SIZE 40, 12 ACTION TheEnd()
Windows 11 Pro 22H2 22621.1848

Microsoft (R) Windows (R) Resource Compiler Version 10.0.10011.16384

Harbour 3.2.0dev (r2008190002)

FWH 23.10 x86

Continue the discussion