Overloading script engine from IHTMLDocument::get_Script
- From: "Dave" <blueturtle@xxxxxxxxxxx>
- Date: 20 Nov 2006 09:38:48 -0800
Hi,
I want to know if (and how) it possible to override the methods of the
IDispatch pointer,
Or replace the script engine, which is retrieved by
IHTMLDocument::get_Script(IDispatch **p).
The target is to be able to do (pseudo code):
// Start ----------------------------------
//
MyNewScriptEngine::GetIDsOfNames(...)
{
if (methodName== "javaScriptA")
{
*dispid = 7777;
}
}
MyNewScriptEngine::Invoke(dispidParam, ...)
{
if (dispidParam == 7777)
{
// do nothing or change params of "javaScriptA", etc...
}
else
{
call the Invoke of original script engine.
}
}
//
// End -------------------------------------
So , when the html contains for example the following function:
// Start -----------------------------------
//
function javaScriptA(msg)
{
alert(msg);
}
//
// End -------------------------------------
I will be able block any calls to it, change values of parameters, etc.
Please note that I have no control of the html content, so I cannot
change the function
To be window.external.javaScriptA, and then process it by intercepting
GetExternal (IDocHostUIHandler)
One more thing - The way I use get_Script, is by:
// Start -----------------------------------
//
RegisterWindowMessage( _T("WM_HTML_GETOBJECT") );
....
SendMessageTimeout(hWndIE, nMsg, 0L, 0L, SMTO_ABORTIFHUNG, 1000, &dwRes
);
....
ObjectFromLresult(dwRes, IID_IHTMLDocument, 0, (void**)&spDoc );
....
spDoc->get_Script(&lpScriptEngine);
//
// End -------------------------------------
Thanks for any help,
Si.
.
- Follow-Ups:
- Re: Overloading script engine from IHTMLDocument::get_Script
- From: Igor Tandetnik
- Re: Overloading script engine from IHTMLDocument::get_Script
- Prev by Date: Re: Open new Internet Explorer window in a new process
- Next by Date: problem with IWebBrowser2::Navigate
- Previous by thread: Missing Submit Input Elements
- Next by thread: Re: Overloading script engine from IHTMLDocument::get_Script
- Index(es):