CUserTool Class
A user tool is a menu item that runs an external application. The Tools tab of the Customize dialog box (CMFCToolBarsCustomizeDialog Class) enables the user to add user tools, and to specify the name, command, arguments, and initial directory for each user tool.
class CUserTool : public CObject
Members
Public Methods
Name |
Description |
---|---|
|
|
Draws the user tool icon in a specified rectangle. |
|
Returns a string that contains the text of the command associated with the user tool. |
|
Returns the command ID of the menu item of the user tool. |
|
Executes the command associated with the user tool. |
|
Reads or writes this object from or to an archive. (Overrides CObject::Serialize.) |
|
Sets the command associated with the user tool. |
|
Loads the icon for the user tool from the application associated with the tool. |
Protected Methods
Name |
Description |
---|---|
Loads the default icon for a user tool. |
Data Members
Name |
Description |
---|---|
The command-line arguments for the user tool. |
|
The initial directory for the user tool. |
|
The tool name that is displayed in the menu item for the tool. |
Remarks
For more information about how to enable user tools in your application, see CUserToolsManager Class.
Example
The following example demonstrates how to create a tool from a CUserToolsManager object, set the m_strLabel member variable, and set the application that the user tool runs. This code snippet is part of the VisualStudioDemo Sample: MFC Visual Studio Application.
// CUserToolsManager* pUserToolsManager
CUserTool* pTool1 = pUserToolsManager->CreateNewTool();
pTool1->m_strLabel = _T("&Notepad");
pTool1->SetCommand(_T("notepad.exe"));
Inheritance Hierarchy
Requirements
Header: afxusertool.h