User32TrackPopupMenu Method
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..
Namespace: DevCase.Win32.NativeMethodsAssembly: DevCase.net48 (in DevCase.net48.dll) Version: 6.0.0.0 (6.0)
XMLNS for XAML: Not mapped to an xmlns.
[DllImportAttribute("User32.dll", SetLastError = true)]
public static int TrackPopupMenu(
IntPtr hMenu,
TrackPopupMenuFlags flags,
int x,
int y,
int reserved,
IntPtr hWnd,
[OptionalAttribute] IntPtr prcRect
)
<DllImportAttribute("User32.dll", SetLastError := true>]
Public Shared Function TrackPopupMenu (
hMenu As IntPtr,
flags As TrackPopupMenuFlags,
x As Integer,
y As Integer,
reserved As Integer,
hWnd As IntPtr,
<OptionalAttribute> prcRect As IntPtr
) As Integer
Dim hMenu As IntPtr
Dim flags As TrackPopupMenuFlags
Dim x As Integer
Dim y As Integer
Dim reserved As Integer
Dim hWnd As IntPtr
Dim prcRect As IntPtr
Dim returnValue As Integer
returnValue = User32.TrackPopupMenu(hMenu,
flags, x, y, reserved, hWnd, prcRect)
public:
[DllImportAttribute(L"User32.dll", SetLastError = true)]
static int TrackPopupMenu(
[InAttribute] IntPtr hMenu,
[InAttribute] TrackPopupMenuFlags flags,
[InAttribute] int x,
[InAttribute] int y,
[InAttribute] int reserved,
[InAttribute] IntPtr hWnd,
[OptionalAttribute] [InAttribute] IntPtr prcRect
)
[<DllImportAttribute("User32.dll", SetLastError = true)>]
static member TrackPopupMenu :
hMenu : IntPtr *
flags : TrackPopupMenuFlags *
x : int *
y : int *
reserved : int *
hWnd : IntPtr *
[<OptionalAttribute>] prcRect : IntPtr -> int
No code example is currently available or this language may not be supported.
- hMenu IntPtr
-
A handle to the menu to be displayed.
The handle can be obtained by calling CreatePopupMenu to create a new menu,
or by calling GetSubMenu to retrieve a handle to a submenu associated with
an existing menu item.
- flags TrackPopupMenuFlags
-
Flags that specifies the alignment, discovery and animations of the menu.
- x Int32
-
The horizontal location of the menu, in screen coordinates.
- y Int32
-
The vertical location of the menu, in screen coordinates.
- reserved Int32
-
Reserved; must be zero.
- hWnd IntPtr
-
A handle to the window that owns the menu.
This window receives all messages from the menu.
The window does not receive a WM_Command message
from the menu until the function returns.
If you specify NoSendNotify
in the flags parameter, the function does not
send messages to the window identified by hWnd parameter.
However, you must still pass a window handle in hWnd parameter.
It can be any window handle from your application.
- prcRect IntPtr (Optional)
-
Ignored; must be Zero.
Int32
If you specify
ReturnCmd in the
flags parameter,
the return value is the menu-item identifier of the item that the user selected.
If the user cancels the menu without making a selection, or if an error occurs, the return value is zero.
If you do not specify
ReturnCmd in the
flags parameter,
the return value is nonzero if the function succeeds and zero if it fails.
To get extended error information, call
GetLastWin32Error.