TrackPopupMenu
The TrackPopupMenu
function displays a shortcut menu at the specified location and tracks the
selection of items on the menu. The shortcut menu can appear anywhere on the
screen.
BOOL TrackPopupMenu(
HMENU hMenu, |
// handle of
shortcut menu |
UINT uFlags, |
// screen-position
and mouse-button flags |
int x, |
// horizontal
position, in screen coordinates |
int y, |
// vertical
position, in screen coordinates |
int nReserved, |
// reserved, must
be zero |
HWND hWnd, |
// handle of owner
window |
CONST RECT *prcRect |
// points to RECT
that specifies no-dismissal area |
); |
|
Parameters
hMenu
Identifies
the shortcut menu to be displayed. The handle can be obtained by calling CreatePopupMenu
uFlags
A set of bit
flags that specify function options.
Use one of
the following bit flag constants to specify how the function positions the
popup menu horizontally:
Value |
Meaning |
TPM_CENTERALIGN |
If this
flag is set, the function centers the shortcut menu horizontally relative to
the coordinate specified by the x parameter. |
TPM_LEFTALIGN |
If this
flag is set, the function positions the shortcut menu so that its left side is
aligned with the coordinate specified by the x parameter. |
TPM_RIGHTALIGN |
Positions
the shortcut menu so that its right side is aligned with the coordinate
specified by the x parameter. |
Use one of
the following bit flag constants to specify which mouse button the shortcut
menu tracks:
Value |
Meaning |
TPM_LEFTBUTTON |
If this
flag is set, the shortcut menu tracks the left mouse button. |
TPM_RIGHTBUTTON |
If this
flag is set, the shortcut menu tracks the right mouse button |
x
Specifies the
horizontal location of the shortcut menu, in screen coordinates.
y
Specifies the
vertical location of the shortcut menu, in screen coordinates.
nReserved
Reserved;
must be zero.
hWnd
Identifies
the window that owns the shortcut menu. This window receives all messages from the
menu. The window does not receive a WM_COMMAND
prcRect
Points to a RECT
Return Values
If the
function succeeds, the return value is nonzero.
If the
function fails, the return value is zero. To get extended error information,
call GetLastError
See Also