Share via


CCommandManager::GetCmdImage

Returns the index of an image that is associated with a specified command ID.

int GetCmdImage(
    UINT uiCmd,
    BOOL bUserImage = FALSE
) const;

Parameters

  • [in] uiCmd
    The command ID of a control.

  • [in] bUserImage
    TRUE if the image is user-defined; FALSE if the image is global.

Return Value

The index of the image if the element is found; otherwise, -1.

Example

The following example demonstrates how to get a reference to a CCommandManager object and use the GetCmdImage method in the CCommandManager class. This code snippet is part of the Explorer Sample: MFC Windows Explorer Application.

// CMenu menuHistory
    CMFCToolBarMenuButton btnBack (ID_GO_BACK, menuHistory, 
                    GetCmdMgr ()->GetCmdImage (ID_GO_BACK), _T("Back"));

Requirements

Header: afxcommandmanager.h

See Also

Concepts

MFC Hierarchy Chart

Reference

CCommandManager Class