How can I detect one or combination of strokes of keys in ANSI C and/or with Win32 SDK?
For example: how can I detect CTRL+ALT+DEL was pressed?
Please provide me with some source code or any web-link.
Please note that, I am using polling mechanism, not event.
I need to do it in win32 console mode.
With ANSI C it is impossible, since ANSI C doesn't define any method to access the keyboard in this manner. The lowest-level function in it that takes input from the user is getc
that returns a character after it has been entered into stdin
and ENTER has been pressed.
As for the Win32 API, indeed this can be done. In the message handling function (WndProc
)you should watch for WM_CHAR
messages. Modifiers will help you see if CTRL and SHIFT are pressed.
P.S. just a thought, maybe what you're looking for is a tool like Autohotkey?
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With