473,569 Members | 2,764 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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.proto type.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 = GetScriptDispat ch(pstrName, &pDispatch);
if (hr == S_OK)
{
IDispatchEx *pDispatchEx;
hr = pDispatch->QueryInterface (IID_IDispatchE x, (void
**)&pDispatchEx );
if (hr == S_OK)
{
pdex = pDispatchEx;

// Assign to pdex
hr = pdex->GetNextDispID( fdexEnumAll, DISPID_STARTENU M, &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 4920
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.proto type.XXX = function( ... )
Then you have the only one function "component.prot otype.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
5953
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 javascript code and work out what it does but I can't really write it from scratch.
5
5228
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 functions or set some var in the html. There are some sample code in C++ using IDispatch but these are beyond me. Looked at Tim Anderson's work on...
7
3280
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 "registerClientScriptBlock" as follows: string script = "<script language=jscript>"; script += "function test()";
9
3321
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 visible to a client using a browser. My question is...can a knowledgeable browser user view Jscript source code in an asp file?
0
1408
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 reference it but I have hit a brick wall.. Can someone steer me in the correct direction on how to interface IActiveScript, and where I could get my...
0
2483
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 containing a Edit(textbox) and button to test at first. When I change text in Edit or press button to setText value, I want to monitor the change event. ...
3
4237
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 : String) : String { return eval(expr); }
4
3208
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 JavaScript using AddNamedItem. When I look at this object and ask it for its type, it says it is a System.__ComObject. What I want to do is invoke...
1
3441
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>
0
7609
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
0
7921
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
1
7666
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
0
6278
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
1
5504
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
0
5217
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
0
3636
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2107
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
0
936
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

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.