_U_MENUorID Class
Collapse the table of content
Expand the table of content
Important This document may not represent best practices for current development, links to downloads and other resources may no longer be valid. Current recommended version can be found here. ArchiveDisclaimer

_U_MENUorID Class 

This class provides wrappers for CreateWindow and CreateWindowEx.

class _U_MENUorID

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

© 2015 Microsoft