- Using shift and function keys...
- Posted by XPprogrammer on August 14th, 2005
Hello,
I need to detect when the user have pressed any function keys,
short cut keys (control+S), and the shift keys (shift+F10).
how can I get my program to identify the key that was pressed?
the program runs under windows 2000 pro.
Thanks for the help.
- Posted by Kellie Fitton on August 14th, 2005
Hi,
1). Call the API CreateAcceleratorTable() to create the table.
2). Call the API LoadAccelerators() to load the specified table.
3). Call the API TranslateAccelerator() to processes accelerator keys.
4). Call the API GetAsyncKeyState() to determine whether a key is up or
down at the
time the function is called.
5). Use the API IsDialogMessage() in the main message loop.
http://msdn.microsoft.com/library/de...ratortable.asp
http://msdn.microsoft.com/library/de...celerators.asp
http://msdn.microsoft.com/library/de...ccelerator.asp
http://msdn.microsoft.com/library/de...celerators.asp
http://msdn.microsoft.com/library/de...nckeystate.asp
Hope these information helps,
Kellie.
- Posted by Sten Westerback on August 15th, 2005
"XPprogrammer" <saud_abraham@hotmail.com> wrote in message
news:1124041774.742248.287040@g49g2000cwa.googlegr oups.com...
Usually one would use Accelerators for that as Kellie pointed out.
However, you could also simple cath WM_KEYDOWN messages
and then call GetKeyState() to find out if any of Ctrl, Alt, Shift was
pressed down at the time the message was sent.
One related warning: Use of Alt can be difficult at times... for instance
Alt and a command from a Menu is really difficult to perform. 
- Sten