Intel® Fortran Compiler
Build applications that can scale for the future with optimized code designed for Intel® Xeon® and compatible processors.
Announcements
FPGA community forums and blogs on community.intel.com are migrating to the new Altera Community and are read-only. For urgent support needs during this transition, please visit the FPGA Design Resources page or contact an Altera Authorized Distributor.
29282 Discussions

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

davidgraham
Beginner
549 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
549 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
549 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
549 Views
Anthony,
Thanks, that's a very simple way to sort the problem.
David
0 Kudos
Reply