If your handler is present on a machine without the local server, a container's calls to IOleObject::DoVerb will fail. If your handler simply delegates all of IOleObject to the default handler, nothing else will happen. What you can do, however, is intercept this call and see whether it fails first. In response to failure, you can display a message telling the user what to do to get real server code:
STDMETHODIMP CImpIOleObject::DoVerb(LONG iVerb, LPMSG pMSG
, LPOLECLIENTSITE pSite, LONG lIndex, HWND hWnd, LPCRECT prc)
{
HRESULT hr;
hr=m_pObj->m_pDefIOleObject->DoVerb(iVerb, pMSG, pSite, lIndex
, hWnd, prc);
if (FAILED(hr))
{
MessageBox(hWnd, TEXT("Local server not present.\nIf\
I wanted to make money\nI would put some advertising here.")
, TEXT("Cosmo Handler"), MB_OK);
}
return hr;
}
This is a wonderful way to sneak in some free advertising! But it does require that you override all the rest of the IOleObject member functions—which are many—to do nothing more than delegate to the default handler. If you choose to do this, you should also override the GetExtent member to call your own IViewObject2::GetExtent.