LoadMenuIndirectW function (winuser.h)

Loads the specified menu template in memory.

Syntax

HMENU LoadMenuIndirectW(
  [in] const MENUTEMPLATEW *lpMenuTemplate
);

Parameters

[in] lpMenuTemplate

Type: const MENUTEMPLATE*

A pointer to a menu template or an extended menu template. A menu template consists of a MENUITEMTEMPLATEHEADER structure followed by one or more contiguous MENUITEMTEMPLATE structures. An extended menu template consists of a MENUEX_TEMPLATE_HEADER structure followed by one or more contiguous MENUEX_TEMPLATE_ITEM structures.

Return value

Type: HMENU

If the function succeeds, the return value is a handle to the menu.

If the function fails, the return value is NULL. To get extended error information, call GetLastError.

Remarks

For both the ANSI and the Unicode version of this function, the strings in the MENUITEMTEMPLATE structure must be Unicode strings.

Note

The winuser.h header defines LoadMenuIndirect as an alias that automatically selects the ANSI or Unicode version of this function based on the definition of the UNICODE preprocessor constant. Mixing usage of the encoding-neutral alias with code that is not encoding-neutral can lead to mismatches that result in compilation or runtime errors. For more information, see Conventions for Function Prototypes.

Requirements

Requirement Value
Minimum supported client Windows 2000 Professional [desktop apps only]
Minimum supported server Windows 2000 Server [desktop apps only]
Target Platform Windows
Header winuser.h (include Windows.h)
Library User32.lib
DLL User32.dll

See also

Conceptual

LoadMenu

MENUEX_TEMPLATE_HEADER

MENUEX_TEMPLATE_ITEM

MENUITEMTEMPLATE

MENUITEMTEMPLATEHEADER

Menus

Reference