_U_MENUorID Class

 

For the latest documentation on Visual Studio 2017 RC, see Visual Studio 2017 RC Documentation.

This class provides wrappers for CreateWindow and CreateWindowEx.

System_CAPS_ICON_important.jpg Important

This class and its members cannot be used in applications that execute in the Windows Runtime.

class _U_MENUorID

Public Constructors

NameDescription
_U_MENUorID::_U_MENUorIDThe constructor.

Public Data Members

NameDescription
_U_MENUorID::m_hMenuA handle to a menu.

This argument adapter class allows either IDs ( UINTs) or menu handles ( HMENUs) 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.

Header: atlwin.h

The class holds the value passed to either of its constructors as a public HMENU data member.

HMENU m_hMenu;

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.

Class Overview

Show: