PRB: ICustomDoc::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.

About Sheng Jiang 蒋晟

Microsoft MVP in Visual C , 2004- Forum moderator of the Visual C and .Net forums on CSDN Forum moderator of Chinese forums on Microsoft's MSDN forums
This entry was posted in enmsdn, Microsoft, Visual C++ and tagged , . Bookmark the permalink.

One Response to PRB: ICustomDoc::SetUIHandler Causes Changes in Save As Dialog

  1. Andy says:

    I’m trying to restore the save as dialog box in my C# code and I have seen the C++ code but can’t seem to figure out the work around in C#. Can you advice?
     
    Cheers
    Andy

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s