Click to Rate and Give Feedback
MSDN
MSDN Library
User Interface
Resources
Menus
Menu Reference
Functions
 GetMenu Function
GetMenu Function

The GetMenu function retrieves a handle to the menu assigned to the specified window.

Syntax

HMENU GetMenu(      
    HWND hWnd );

Parameters

hWnd
[in] Handle to the window whose menu handle is to be retrieved.

Return Value

The return value is a handle to the menu. If the specified window has no menu, the return value is NULL. If the window is a child window, the return value is undefined.

Remarks

GetMenu does not work on floating menu bars. Floating menu bars are custom controls that mimic standard menus; they are not menus. To get the handle on a floating menu bar, use the Active Accessibility APIs.

Example

For an example, see Adding Lines and Graphs to a Menu.

Function Information

Minimum DLL Versionuser32.dll
HeaderDeclared in Winuser.h, include Windows.h
Import libraryUser32.lib
Minimum operating systems Windows 95, Windows NT 3.1
UnicodeImplemented as Unicode version.

See Also

Tags What's this?: Add a tag
Community Content   What is Community Content?
Add new content RSS  Annotations
vb.net syntax      dmex   |   Edit   |   Show History
<DllImport("user32.dll", CharSet:=CharSet.Auto)> Public Shared Function GetMenu(ByVal hWnd As HandleRef) As IntPtr
End Function
Tags What's this?: Add a tag
Flag as ContentBug
C# syntax      dmex   |   Edit   |   Show History
[DllImport("user32.dll", CharSet=CharSet.Auto)]
public static extern IntPtr GetMenu(HandleRef hWnd);
Tags What's this?: Add a tag
Flag as ContentBug
Processing
© 2009 Microsoft Corporation. All rights reserved. Terms of Use | Trademarks | Privacy Statement | Site Feedback
Page view tracker