Intel® Fortran Compiler
Build applications that can scale for the future with optimized code designed for Intel® Xeon® and compatible processors.
29238 Discussions

How can I tell if an accelerator key has been pressed?

davidgraham
Beginner
520 Views
I'm using a menu, tool bar buttons and accellerator keys to access menu items.
Is there a way to tell if an accelerator button has been pressed rather than the menu directly?
Thanks
0 Kudos
3 Replies
anthonyrichards
New Contributor III
520 Views
Give the accelerator a diffent ID from the menu item it covers. Then the WM_COMMAND wParam parameter will contain a different ID according to whether the Menu or the Accelerator was used. Process both commands identically.
0 Kudos
IanH
Honored Contributor III
520 Views
Anthony's suggestion is probably more robust and flexible, but an alternative is to examine the contents of the high word of the wparam argument provided with the WM_COMMAND message - it should be 0 if the command has come from the menu or 1 if the command cam via an accelerator.
0 Kudos
davidgraham
Beginner
520 Views
Anthony,
Thanks, that's a very simple way to sort the problem.
David
0 Kudos
Reply