SetKey with ALT key doesn't work

Re: SetKey with ALT key doesn't work

Postby frose » Wed Feb 01, 2012 7: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: Select all  Expand view
@  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
User avatar
frose
 
Posts: 392
Joined: Tue Mar 10, 2009 11:54 am
Location: Germany, Rietberg

Previous

Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: No registered users and 23 guests