Re: how to prevent script error warning dialog box in CHtmlView app?



"misan" <misanel@xxxxxxxx> wrote in message
news:eoRU6FhNGHA.516@xxxxxxxxxxxxxxxxxxxx
thanks!
i try the following in VC7.1 ( winxp(sp2),IE6,.Net2003)

//overide CHtmlControlSite which CHtmlView has extends this control
site
class CCustomControlSite:public CHtmlControlSite
{
public:
CCustomControlSite(COleControlContainer
*pCnt):CHtmlControlSite(pCnt){}
protected:
DECLARE_INTERFACE_MAP();
BEGIN_INTERFACE_PART(OleCommandTarget,IOleCommandTarget)
STDMETHOD(QueryStatus)( const GUID *pguidCmdGroup,ULONG
cCmds,OLECMD prgCmds[ ],OLECMDTEXT *pCmdText);
STDMETHOD(Exec)( const GUID *pguidCmdGroup,DWORD nCmdID,DWORD
nCmdexecopt,VARIANT *pvaIn,VARIANT *pvaOut);
END_INTERFACE_PART(OleCommandTarget)
};

//overide the func:
BOOL CMyHtmlView::CreateControlSite(COleControlContainer* pContainer,
COleControlSite** ppSite, UINT /* nID */, REFCLSID /* clsid */)
{
ASSERT(ppSite != NULL);
*ppSite = new CCustomControlSite(pContainer);
return TRUE;
}

then "CCustomControlSite::XOleCommandTarget::Exec" can be debug into,
but i never found £ºnCmdID == OLECMDID_SHOWSCRIPTERROR

could you please:anything wrong?

Looks good to me. I'm not that familiar with MFC myself, but here's a
report from someone who made it work, with a substantially identical
code:

http://groups.google.com/group/microsoft.public.inetsdk.programming.webbrowser_ctl/browse_frm/thread/b44d7d748175ba88/7a9b9a78bc9221f2

Try playing with Disable Script Debugging checkboxes under Tools |
Internet Options | Advanced.
--
With best wishes,
Igor Tandetnik

With sufficient thrust, pigs fly just fine. However, this is not
necessarily a good idea. It is hard to be sure where they are going to
land, and it could be dangerous sitting under them as they fly
overhead. -- RFC 1925


.



Relevant Pages