Board index » cppbuilder » JavaScript Errors (overwrite Exec method)

JavaScript Errors (overwrite Exec method)


2005-11-29 03:08:49 AM
cppbuilder14
Hello !
I need help handling JavaScript erros. I've seen the MSDN article:
support.microsoft.com/default.aspx
And I found the next "extra" explanation about how to implement that:
"Basically, you need to implement your own web browser control that
implements IOleCommandTarget. IOleCommandTarget.Exec will be called with a
Command Group of CGID_DocHostCommandHandler and a Command ID of
OLECMDID_SHOWSCRIPTERROR when an unhandled scripting error is sent to the
browser control.
You can achieve this by deriving a new class that decends from TOleControl
(which already implements IOleCommandTarget) and implementing a virtual
protected Exec there, then creating a new WebBrowser control (or add the
existing one to your project and change it) that derives from your new
TOleControl decendant instead of TOleControl itself. Override Exec in this
WebBrowser control, and you should be good to go. This also alows you to
taylor many other WebBrowser related things by tweaking your TOleControl
decendant's implementation of its various interfaces."
The problem is: I don't know how to do it =(
How can I create a new WebBrowser control that derives from mi new
TOleControl?
I have tried something like this:
class TOleControlMio : public TOleControl
{
virtual STDMETHODIMP Exec( const GUID* pguidCmdGroup, DWORD nCmdID,
DWORD nCmdexecopt, VARIANTARG* pvaIn, VARIANTARG* pvaOut );
};
class TCppWebBrowserMio : public TCppWebBrowser, TOleControlMio
{
};
But it gives to me the next error:
"Multiple base classes not supported for Delphi classes"
anyway, I think that it won't work this way.
How can I "overwrite" the Exec method from IOleCommandTarget???
Thanks !
enrique.
 
 

Re:JavaScript Errors (overwrite Exec method)

See my reply in the .ActiveX group...
Mark
"Enrique" < XXXX@XXXXX.COM >wrote in message
Quote
Hello !
I need help handling JavaScript erros. I've seen the MSDN article:
support.microsoft.com/default.aspx

And I found the next "extra" explanation about how to implement that:

"Basically, you need to implement your own web browser control that
implements IOleCommandTarget. IOleCommandTarget.Exec will be called with
a
Command Group of CGID_DocHostCommandHandler and a Command ID of
OLECMDID_SHOWSCRIPTERROR when an unhandled scripting error is sent to the
browser control.
You can achieve this by deriving a new class that decends from TOleControl
(which already implements IOleCommandTarget) and implementing a virtual
protected Exec there, then creating a new WebBrowser control (or add the
existing one to your project and change it) that derives from your new
TOleControl decendant instead of TOleControl itself. Override Exec in
this
WebBrowser control, and you should be good to go. This also alows you to
taylor many other WebBrowser related things by tweaking your TOleControl
decendant's implementation of its various interfaces."

The problem is: I don't know how to do it =(
How can I create a new WebBrowser control that derives from mi new
TOleControl?

I have tried something like this:

class TOleControlMio : public TOleControl
{
virtual STDMETHODIMP Exec( const GUID* pguidCmdGroup, DWORD nCmdID,
DWORD nCmdexecopt, VARIANTARG* pvaIn, VARIANTARG* pvaOut );
};

class TCppWebBrowserMio : public TCppWebBrowser, TOleControlMio
{
};

But it gives to me the next error:
"Multiple base classes not supported for Delphi classes"
anyway, I think that it won't work this way.
How can I "overwrite" the Exec method from IOleCommandTarget???

Thanks !
enrique.