The RunCommand method instructs the ExpressAddin component to execute a specified
Application Integration command. Prior to calling RunCommand, the Startup
method must be used to initialize the ExpressAddin component.
HRESULT hResult = spIExpressAddin->RunCommand(BSTR bstrCommand);
...
BOOL AddinSampleDlg::OnInitDialog()
{
CDialog::OnInitDialog();
SetupDialog();
try
{
// Initialize a smart pointer to the IExpressAddin interface.
HRESULT hResult = m_spIAddin.CreateInstance( CLSID_ExpressAddin );
if ( FAILED( hResult ) )
{
return FALSE;
}
...
return TRUE;
}
...
void AddinSampleDlg::OnFileNetOpenViaSelectItem()
{
HRESULT hResult = S_OK;
try
{
// Run the "Open using Select Item" process.
hResult = m_spIAddin->RunCommand( _bstr_t( _T( "ExpressAddin.OpenSelectItem" ) ) );
}
catch ( _com_error &err )
{
AfxMessageBox( err.ErrorMessage() );
}
catch( ... )
...
}
...