PRB: ::SetUIHandler Causes Changes in Save As Dialog#

For the description of this problem, see http://support.microsoft.com/kb/330441.

A workaround is delegating DHTML commands to the origional webbrowser object through its IOleCommandTarget interface. A sample can be found at http://www.codeproject.com/atl/popupblocker.asp:

STDMETHOD(Exec)(
   /*[in]*/ const GUID *pguidCmdGroup,
   /*[in]*/ DWORD nCmdID,
   /*[in]*/ DWORD nCmdExecOpt,
   /*[in]*/ VARIANTARG *pvaIn,
   /*[in,out]*/ VARIANTARG *pvaOut)
{
   if (nCmdID == OLECMDID_SHOWSCRIPTERROR)
   {
      // Don't show the error dialog, but
      // continue running scripts on the page.
      (*pvaOut).vt = VT_BOOL;
      (*pvaOut).boolVal = VARIANT_TRUE;
      return S_OK;
   }
   return m_spDefaultOleCommandTarget->Exec(pguidCmdGroup, nCmdID,
   nCmdExecOpt, pvaIn, pvaOut);
}

By redirecting the ole commands to the original client site, the save as options are restored.

BTW, the sentence “This means that you must host the Web browser control must be hosted” in the article seems confusing.