RockWallaby 1 Posted May 23 Hi, Is it possible to detect if the CTRL or SHIFT key is being held down when an application starts? = Steve Share this post Link to post
Lajos Juhász 270 Posted May 23 1 hour ago, RockWallaby said: Is it possible to detect if the CTRL or SHIFT key is being held down when an application starts? You can query the state of these buttons using https://learn.microsoft.com/en-us/windows/win32/api/winuser/nf-winuser-getkeystate if GetKeyState(VK_CONTROL)<0 then .... if GetKeyState(VK_SHIFT)<0 then .... 1 Share this post Link to post
Anders Melander 1705 Posted May 23 Use GetAsyncKeyState instead of GetKeyState. GetKeyState will get you the state of the keys when a message was last read from the Windows message queue. This may or may not correspond to the current keyboard state. GetAsyncKeyState will get you the current state. 1 1 Share this post Link to post