CMouseManager::AddView

Registers a CView object with the CMouseManager Class to support custom mouse behavior.

BOOL AddView(
   int iViewId,
   UINT uiViewNameResId,
   UINT uiIconId = 0
);
BOOL AddView(
   int iId,
   LPCTSTR lpszViewName,
   UINT uiIconId = 0
);

Parameters

  • [in] iViewId
    A view ID.

  • [in] uiViewNameResId
    A resource string ID that references the view name.

  • [in] uiIconId
    A view icon ID.

  • [in] iId
    A view ID.

  • [in] lpszViewName
    A view name.

Return Value

Nonzero if successful; otherwise 0.

Remarks

In order to support custom mouse behavior, a view must be registered with the CMouseManager object. Any object derived from the CView class can be registered with the mouse manager. The string and icon associated with a view are displayed in the Mouse tab of the Customize dialog box.

It is the responsibility of the programmer to create and maintain view IDs such as iViewId and iId.

For more information about how to provide custom mouse behavior, see Keyboard and Mouse Customization.

Example

The following example demonstrates how to retrieve a pointer to a CMouseManager object by using the CWinAppEx::GetMouseManager method and the AddView method in the CMouseManager class. This code snippet is part of the State Collection sample.

    GetMouseManager()->AddView (IDR_MAINFRAME, _T("My view"), IDR_MAINFRAME);

Requirements

Header: afxmousemanager.h

See Also

Reference

CMouseManager Class

Hierarchy Chart

Concepts

Keyboard and Mouse Customization