The Add-In sample application can be easily modified to gain a better understanding of the capabilities of the ExpressAddin. This section explains how to go about making modifications to the sample application source code.
NOTE The Sample Add-In files are installed on the system as read-only. Developers should set the file permissions to writable prior to editing.
applicationName
,
useUnifiedLogin
, and applicationMimeTypes
settings
of the Startup method to meet
your application requirements:...
_bstr_t AddinSampleDlg::ComposeStartupXml()
{
// Specify the startup XML for the ApplicationName,
// the ApplicationID, and the array of Application Mimetypes.
_bstr_t startupXml = _T( "" );
startupXml += _T("<?xml version=\"1.0\" ?>");
startupXml += _T("<object key=\"addInConfiguration\" version=\"1.0\">");
startupXml += _T("<setting key=\"applicationName\">AddinSampleApp</setting>");
startupXml += _T("<setting key=\"useUnifiedLogin\">true</setting>");
startupXml += _T("<array key=\"applicationMimeTypes\">");
startupXml += _T("<value>text/xml</value>");
startupXml += _T("<value>text/html</value>");
startupXml += _T("<value>text/txt</value>");
startupXml += _T("<value>text/plain</value>");
startupXml += _T("<value>application/msword</value>");
startupXml += _T("</array>");
startupXml += _T("</object>");
return startupXml;
}
...
...
// --- Event handler implementations ---
HRESULT __stdcall CEventHandler::OnAppBeginWaitCursor()
{
// Display the application's wait cursor.
AfxGetMainWnd()->BeginWaitCursor();
return S_OK;
}
HRESULT __stdcall CEventHandler::OnAppEndWaitCursor()
{
// End the application's wait cursor.
AfxGetMainWnd()->EndWaitCursor();
return S_OK;
}
HRESULT __stdcall CEventHandler::OnAppExistsActiveDocument( VARIANT_BOOL *pExistsActiveDocument )
{
// Query the document object to determine if there is an active document.
if( m_pDocument->ExistsActiveDocument() )
{
*pExistsActiveDocument = VARIANT_TRUE;
}
else
{
*pExistsActiveDocument = VARIANT_FALSE;
}
return S_OK;
}
HRESULT __stdcall CEventHandler::OnAppInsertHyperlink( BSTR urlName
{
m_pDocument->InsertHyperlink( urlName );
return S_OK;
}
...
#import
statement
to point to the correct location of the FnAppIntExpressAddin.dll file.