_U_MENUorID Class
The new home for Visual Studio documentation is Visual Studio 2017 Documentation on docs.microsoft.com.
The latest version of this topic can be found at _U_MENUorID Class.
This class provides wrappers for CreateWindow and CreateWindowEx.
Important
This class and its members cannot be used in applications that execute in the Windows Runtime.
Syntax
class _U_MENUorID
Members
Public Constructors
Name | Description |
---|---|
_U_MENUorID::_U_MENUorID | The constructor. |
Public Data Members
Name | Description |
---|---|
_U_MENUorID::m_hMenu | A handle to a menu. |
Remarks
This argument adapter class allows either IDs ( UINTs) or menu handles ( HMENU
s) to be passed to a function without requiring an explicit cast on the part of the caller.
This class is designed for implementing wrappers to the Windows API, particularly the CreateWindow and CreateWindowEx functions, both of which accept an HMENU
argument that may be a child window identifier ( UINT) rather than a menu handle. For example, you can see this class in use as a parameter to CWindowImpl::Create.
The class defines two constructor overloads: one accepts a UINT argument and the other accepts an HMENU
argument. The UINT argument is just cast to an HMENU
in the constructor and the result stored in the class's single data member, m_hMenu. The argument to the HMENU
constructor is stored directly without conversion.
Requirements
Header: atlwin.h
_U_MENUorID::m_hMenu
The class holds the value passed to either of its constructors as a public HMENU
data member.
HMENU m_hMenu;
_U_MENUorID::_U_MENUorID
The UINT argument is just cast to an HMENU
in the constructor and the result stored in the class's single data member, m_hMenu.
_U_MENUorID(UINT nID);
_U_MENUorID(HMENU hMenu);
Parameters
nID
A child window identifier.
hMenu
A menu handle.
Remarks
The argument to the HMENU
constructor is stored directly without conversion.