473,406 Members | 2,894 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,406 software developers and data experts.

Hook JScript functions using IActiveScript using C++

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.

Dec 31 '06 #1
1 4904
VK

Eran wrote:
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( ... )
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.

Dec 31 '06 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

20
by: Harag | last post by:
Hi All. I'm stating out doing some web developing. I was wondering which of the server side languages should I concentrate on and learn. I Know CSS, HTML, T-SQL I can look at the client...
5
by: benc | last post by:
Hi Can some good soul help on this. I need to call jscript functions from C#. I have hosted a web control and displayed an html page successfully, but just can't find a way to call jscript...
7
by: RFS666 | last post by:
Hello, I would like to use variables with a type in jscript.NET. I declare them as follows: var x : double = 5.03; This doesn't work in my script, that I write to the page in codebehind with...
9
by: WRH | last post by:
Hello I am new to asp but I made some Jscript functions which work fine. The functions contain some strings used as a registration key for some apps. It is important that these strings not be...
0
by: Karl | last post by:
Hi, I was wondering if it is possible to access IActiveScript interface within VB.Net. I am of the belief I am going to have to compile a TLB with the necessary declarations etc and then...
0
by: zeng.hui.stephen | last post by:
I download the demo http://msdn.microsoft.com/msdnmag/issues/02/10/cuttingedge/. I inherite the demo, and write my code. I want to use Hook to monitor C++ Edit change. I use a C# form...
3
by: bowser | last post by:
Hello, I have a problem of communication between JScript and C#. I must say that I'm new to both. In a JS file I have to call a C# function. In particular I have: public function Eval(expr :...
4
by: Nathan Baker | last post by:
I have a JavaScript environment using IActiveScript and friends (via COM interop). At one point, the JavaScript passes me a function as a parameter to an object that has been inserted into the...
1
by: Andrew Wan | last post by:
How can VBScript code access JScript code variables in the same ASP page? <SCRIPT LANGAUGE="VBScript"> Dim a a = 10 </SCRIPT> <SCRIPT LANGUAGE="JScript"> Response.Write(a); </SCRIPT>
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.