Article ID: 187920
Article Last Modified on 2/12/2007
BOOL CRectItem::DoVerb(LONG nVerb, CView* pView, LPMSG lpMsg)
{
ASSERT_VALID(this);
if (pView != NULL)
ASSERT_VALID(pView);
if (lpMsg != NULL)
ASSERT(AfxIsValidAddress(lpMsg, sizeof(MSG), FALSE));
TRY
{
Activate(nVerb, pView, lpMsg);
}
CATCH ( COleException, exception )
{
/*Here's the change. If the linked object's source has changed,
re-bind it to the correct source so Word 97 launches
correctly.*/
if (COleException::Process( exception) == 0x80040008){
IOleLink* fOleLink;
m_lpObject->QueryInterface(IID_IOleLink, (void**)&fOleLink);
IBindCtx* fBinder;
CreateBindCtx(0, &fBinder);
fOleLink->BindToSource(OLELINKBIND_EVENIFCLASSDIFF,
fBinder);
Activate(nVerb, pView, lpMsg);
fOleLink->Release();
fBinder->Release();
exception->Delete ();
}
else
{
// Catch OLE errors and report them as such.
if (!ReportError(exception->m_sc))
AfxMessageBox(AFX_IDP_FAILED_TO_LAUNCH);
exception->Delete ();
return FALSE;
}
}
AND_CATCH_ALL(exception)
{
// Otherwise, show generic error.
AfxMessageBox(AFX_IDP_FAILED_TO_LAUNCH);
exception->Delete ();
return FALSE;
}
END_CATCH_ALL
return TRUE;
}
BOOL DoVerb(LONG nVerb, CView* pView, LPMSG lpMsg);
pItem->DoVerb(OLEIVERB_SHOW, this, NULL);
m_pSelection->DoVerb(iVerb, this, NULL);
DoVerb(OLEIVERB_HIDE, NULL, NULL);
Keywords: kbautomation kbinterop kbprb KB187920