Export (0) Print
Expand All

LoadMenu function

Loads the specified menu resource from the executable (.exe) file associated with an application instance.

Syntax


HMENU WINAPI LoadMenu(
  _In_opt_  HINSTANCE hInstance,
  _In_      LPCTSTR lpMenuName
);

Parameters

hInstance [in, optional]

Type: HINSTANCE

A handle to the module containing the menu resource to be loaded.

lpMenuName [in]

Type: LPCTSTR

The name of the menu resource. Alternatively, this parameter can consist of the resource identifier in the low-order word and zero in the high-order word. To create this value, use the MAKEINTRESOURCE macro.

Return value

Type: HMENU

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

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

Remarks

The DestroyMenu function is used, before an application closes, to destroy the menu and free memory that the loaded menu occupied.

Examples

For an example, see Displaying a Shortcut Menu

Requirements

Minimum supported client

Windows 2000 Professional [desktop apps only]

Minimum supported server

Windows 2000 Server [desktop apps only]

Header

Winuser.h (include Windows.h)

Library

User32.lib

DLL

User32.dll

Unicode and ANSI names

LoadMenuW (Unicode) and LoadMenuA (ANSI)

See also

Reference
LoadMenuIndirect
MAKEINTRESOURCE
Conceptual
Menus

 

 

Community Additions

ADD
Show:
© 2014 Microsoft