Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsGeneralPHPASPPerlColdFusionFlashHTML, CSS, ScriptsBrowsers

Webmaster Forum / HTML, CSS, Scripts / JavaScript / December 2006



Tip: Looking for answers? Try searching our database.

Hook JScript functions using IActiveScript using C++

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Eran - 31 Dec 2006 17:02 GMT
I am trying to hook up or get some kind of a notification event when
the script engine is executing a certain JScript function.

The script engine is not hosted in IE, but in an independent
application.

The Java script functions are declared in the following way:
component.prototype.XXX = function( ... )

I have an instance of IActiveScript and tried to enumerate all the
available DISPIDs, but could not notice any member name that is similar
to the above function name prototype.

The DISPIDs enumeration code:
------------------------------------------------------

IDispatch *pDispatch = 0;
hr = GetScriptDispatch(pstrName, &pDispatch);
if (hr == S_OK)
{
  IDispatchEx *pDispatchEx;
  hr = pDispatch->QueryInterface(IID_IDispatchEx, (void
**)&pDispatchEx);
  if (hr == S_OK)
  {
     pdex = pDispatchEx;

     // Assign to pdex
     hr = pdex->GetNextDispID(fdexEnumAll, DISPID_STARTENUM, &dispid);
     while (hr == NOERROR)
     {
        hr = pdex->GetMemberName(dispid, &bstrName);
        hr = pdex->GetNextDispID(fdexEnumAll, dispid, &dispid);
     }
  }
}

Is there any way of getting such an event ?

Thanks,
Eran.
VK - 31 Dec 2006 20:11 GMT
> I am trying to hook up or get some kind of a notification event when
> the script engine is executing a certain JScript function.
[quoted text clipped - 4 lines]
> The Java script functions are declared in the following way:
> component.prototype.XXX = function( ... )

Then you have the only one function "component.prototype.XXX" you
GetDispID directly (methods in the prototype chain are static in Cx
sense).

Also DISPIDs in JScript are not reusable so they are actual only for
this given call. This way your logic seems reversed. You do not study
DISPIDs in search of the matching name, but you study string names and
requesting current DISPID for it if the name is what you want.

>From the other side I didn't dance with C++ <> jscript.dll bridging
since last summer plus I had some champagne already :-) so my
statements may be disputable.
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2009 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.