Compartilhar via


CMFCCmdUsageCount Class

Tracks the usage count of Windows messages, such as when the user selects an item from a menu.

class CMFCCmdUsageCount : public CObject

Members

Public Constructors

Name

Description

CMFCCmdUsageCount::CMFCCmdUsageCount

Default constructor.

CMFCCmdUsageCount::~CMFCCmdUsageCount

Destructor.

Public Methods

Name

Description

CMFCCmdUsageCount::AddCmd

Increments by one the counter that is associated with the given command.

CMFCCmdUsageCount::GetCount

Retrieves the usage count that is associated with the given command ID.

CMFCCmdUsageCount::HasEnoughInformation

Determines whether this object has collected the minimum amount of tracking data.

CMFCCmdUsageCount::IsFreqeuntlyUsedCmd

Determines whether the given command is frequently used.

CMFCCmdUsageCount::Reset

Clears the usage count of all commands.

CMFCCmdUsageCount::Serialize

Reads this object from an archive or writes it to an archive. (Overrides CObject::Serialize.)

CMFCCmdUsageCount::SetOptions

Sets the values of shared CMFCCmdUsageCount class data members.

Data Members

Name

Description

m_CmdUsage

A CMap object that maps commands to their usage counts.

m_nMinUsagePercentage

The minimum usage percentage for a command to be frequently used.

m_nStartCount

The start counter that is used to determine whether this object has collected the minimum amount of tracking data.

m_nTotalUsage

The count of all tracked commands.

Remarks

The CMFCCmdUsageCount class maps each numeric Windows message identifier to a 32-bit unsigned integer counter. CMFCToolBar uses this class to display frequently-used toolbar items. For more information about CMFCToolBar, see CMFCToolBar Class.

You can persist CMFCCmdUsageCount class data between runs of your program. Use the CMFCCmdUsageCount::Serialize method to serialize class member data and the CMFCCmdUsageCount::SetOptions method to set shared member data.

Inheritance Hierarchy

CObject

   CMFCCmdUsageCount

Requirements

Header: afxcmdusagecount.h

See Also

Reference

Hierarchy Chart

CMFCToolBar Class

Other Resources

MFC Classes