HOWTO: Detect Keystrokes While a Menu Is Pulled Down

ID: Q35930


The information in this article applies to:
  • Microsoft Win32 Software Development Kit (SDK)
  • Microsoft Windows Software Development Kit (SDK) versions 3.0, 3.1
  • Microsoft Windows 2000

In the Windows environment, there are two methods that an application can use to receive notification that a key is pressed while a menu is dropped down:
  • The easier method is to process the WM_MENUCHAR message that is sent to an application when the user presses a key that does not correspond to any of the accelerator keys defined for the current menu.


  • The other method is to use a message filter hook or a keyboard hook specified with the SetWindowsHook function. The hook function can process a message before it is dispatched to a dialog box, message box, or menu.



SUMMARY

Additional query words:

Keywords : kbHook kbNTOS kbGrpUser kbWinOS
Version : WINDOWS:3.0,3.1
Platform : WINDOWS
Issue type : kbhowto


Last Reviewed: February 1, 2000
© 2000 Microsoft Corporation. All rights reserved. Terms of Use.