Compartir a través de


CustomTrackPopupMenu

A version of this page is also available for

Windows Embedded CE 6.0 R3

4/8/2010

This function displays a custom OEM drawn pop-up menu at the specified location and tracks the selection of items on the pop-up menu. The custom pop-up menu can appear anywhere on the screen.

Syntax

BOOL CustomTrackPopupMenu(
HMENU hmenu,
UNIT uFlags,
Int x,
Int y,
HWND hWnd,
LPTPMPARAMS lpTpm,
BOOL fSelectFirst,
BOOL *pfCustomTracked
);

Parameters

  • hmenu
    [in] Handle to the shortcut menu to be displayed. This handle can be obtained by calling the CreatePopupMenu function to create a new shortcut menu or by calling the GetSubMenu function to retrieve the handle to a submenu associated with an existing menu item.
  • uFlags
    [in] Bit flags specifying positioning and other options. This parameter can be zero or more of the values listed with the TrackPopupMenu function.
  • x
    [in] Horizontal location of the shortcut menu, in screen coordinates.
  • y
    [in] Vertical location of the shortcut menu, in screen coordinates.
  • hwnd
    [in] Handle to the window that owns the shortcut 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.
  • lpTpm
    [in] Long pointer to a TPMPARAMS structure that specifies an area of the screen the menu should not overlap. This parameter can be NULL.
  • fSelectFirst
    [in] Specifies whether the first menu item should be selected when the menu is displayed.
  • *pfCustomTracked
    [out] TRUE if the customization was done. FALSE if the customization was not done. If this parameter is set to FALSE the default menu is shown.

Return Value

If you specify TPM_RETURNCMD in the uFlags 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, then the return value is zero.

If you do not specify TPM_RETURNCMD in the uFlags parameter, the return value is nonzero if the function succeeds and zero if it fails. To get extended error information, call GetLastError.

Remarks

Note

If the parameter pfCustomTracked is FALSE, the default menu is shown.

Enabling Custom Pop-up Menus

You can enable custom pop-up menus by completing the following steps.

  1. Enable custom pop-up menus in the registry.
  2. Implement and export the function CustomTrackPopupMenu() to an in-ROM DLL named "CUIHandler".

You can enable custom pop-up menus by configuring the following registry key.

HKLM\System\Gwe\Menu

To enable custom pop-up menus, set the following registry value.

Name Type Description

CUIHandler

DWORD

Specifies whether to enable custom pop-up menu. Set 1 to enable custom pop-up menu. Set to 0 to disable custom pop-up menus.

See Also

Reference

CreatePopupMenu
GetSubMenu
TPMPARAMS
TrackPopupMenu
WM_COMMAND
Menus Functions