Accessing Functions in a JScript.NET assem

R

Rashad Rivera

Hi Gang,

My question is directed more towards the MS JSctip.NET
dev team. I understand that you guys are planning to
implement events in the newer versions of JS.NET, but is
there a way to work around this problem now? I thought I
could access a function in a HTA application by passing it
into a JS.NET assembly. I learned of that it in exposed in
the asm as an Object(AKA: System.__ComObject). But I am
unable to cast it to a local Function variable. I tried
using the TypeDescriptor and converting it that way, but I
keep getting compile error, (type mispatches), and other
runtime errors. The closest i get is when I cast this way:

public function recieveFunction(f : Object) : void {
var theFunction : Function = (Function)f.valueOf();
theFunction(); // runtime error
}

Am I not using the type converter classes properly?:

public function recieveFunction(f : Object) : void {
var theFunction : Function;
if (!TypeDescriptor.GetConverter(typeof
(Function)).IsValid(f))
throw 0; // throw something
else
theFunction =
TypeDescriptor.GetConverter(typeof(Function)).ConvertTo(f,
typeof(Function));
}

And for my next question, is there a way to expose the
MSHTML library in a JS.NET assembly directly. I mean
without having to write a C/VB.NET control. I know that
we can reference the lib in VB,J++ and C++ but is there a
way to do that in JS?

If this is the wrong group, and I think it may be, then
can someone direct me to the group that handles this type
of inquerry.

Any help would be appreciated


- rashad
"if you want to reply to me directly, just remove the "-
noSpamPlease" and "NOSPAM" from my address
 
P

Peter Torr \(MS\)

Rashad Rivera said:
I thought I
could access a function in a HTA application by passing it
into a JS.NET assembly. I learned of that it in exposed in
the asm as an Object(AKA: System.__ComObject). But I am
unable to cast it to a local Function variable.

Hi,

A "Function" is something very specific in JScript; it is not a normal .NET
method. You should check out my samples on GotDotNet if you want to see
JScript .NET interacting with IE.

http://www.gotdotnet.com/userfiles/torrboy/pdc2001.zip

Peter
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,576
Members
45,054
Latest member
LucyCarper

Latest Threads

Top