Allows access to a command for the command window.
.NET Syntax
Visual Basic (Declaration) | |
---|
Public Interface ICommand |
C# | |
---|
public interface ICommand |
JavaScript | |
---|
Object dsCommand |
COM native C++ | |
---|
interface ICommand |
Example
The following code snippets show how to add a command to the list of commands for the command window:
COM Native C++
DsAddinCommand.h
public:
CComQIPtr<ICommand> m_DsCommand;
DsAddinCommand.cpp
// DsAddinCommand constructor
DsAddinCommand::DsAddinCommand( ICommand* dsCommand ): m_DsCommand( dsCommand )
{
IUnknown* dsUnk = NULL ;
HRESULT hr = m_DsCommand->QueryInterface(IID_IUnknown, (void **) &dsUnk);
hr = DispEventAdvise(dsUnk);
}
DsAddinUserCommand.cpp
DsAddinUserCommand::DsAddinUserCommand( _bstr_t ApiUuid, _bstr_t UserCmdName, _bstr_t CmdString, _bstr_t Description, _bstr_t SmallIcon, _bstr_t LargeIcon )
{
{
CDsAddinConnection *dsConnection = getMyApp();
dsCreateCommandError_e commandErr;
// User command dependent on pre-defined command
ICommand* pCommand = dsConnection->m_DsApp->CreateCommand( ApiUuid, UserCmdName, &commandErr );
m_DsUserCommand = dsConnection->m_DsApp->CreateUserCommand( ApiUuid, UserCmdName, CmdString, Description, SmallIcon, LargeIcon, &commandErr );
DsAddinCommand *dsAddCom = new DsAddinCommand(pCommand);
}
C++
dsString UserCommandName = L"qAddin1_Notepad";
dsString Description = L"Opens Notepad";
dsString UserCmdString = L"^C^CqAddin1_Notepad";
const int MENU_POSITION = 9; //Menu should be between "Modify" and "Tools" menus
dsApplication_c *dsApp = getDsApp();
dsCreateCommandError_e Error;
// User command dependent on pre-defined command
dsApp->CreateCommand(myApplication::appID, UserCommandName, &Error, &pCmd );
if(( Error == 0 ) )
{
RegisterCommandExecuteNotifyHook( pCmd );
dsUserCommand_ptr pUserCmd;
dsApp->CreateUserCommand( myApplication::appID, UserCommandName, UserCmdString, Description, L"path_and_file_name.bmp", L"path_and_file_name.png", dsUIState_Document, &Error, &pUserCmd );
Remarks
Accessors
See Also