The information in this article applies to:
SUMMARYThe TrackPopupMenu function allows an application to receive input from a menu that is displayed anywhere within the application's client area. This article demonstrates how to change the menu's default behavior for mouse selections. MORE INFORMATIONThe default action for floating pop-up menus maintained with TrackPopupMenu is as follows:
An application can change the behavior of a floating pop-up menu displayed in response to a WM_*BUTTONDOWN message to keep it visible after the mouse button is released. However, when an application uses the techniques described below, it changes the menu's user interface. Specifically, to change menu selections with the mouse, the user must first release the mouse button and then press it again. Dragging the mouse between items with the button down, without releasing the button at least once, will not change the selection. To cause a floating pop-up menu to remain visible after it is displayed in response to a WM_*BUTTONDOWN message, follow these four steps:
The code fragment below changes the state of the VK_LBUTTON to 0 (up) during the processing of a WM_LBUTTONDOWN message. This causes TrackPopupMenu to act as if the menu were displayed as the result of a WM_LBUTTONUP message or of a keystroke. Therefore, the menu remains visible even after the mouse button is released and the WM_LBUTTONUP message is received. Items on this menu can be selected with the mouse or the keyboard.
Additional query words:
Keywords : kbMenu kbNTOS kbGrpUser kbWinOS |
Last Reviewed: February 1, 2000 © 2000 Microsoft Corporation. All rights reserved. Terms of Use. |