Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Accessing Functions in a JScript.NET assem

0 views
Skip to first unread message

Rashad Rivera

unread,
Jan 14, 2004, 11:39:30 PM1/14/04
to
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

Peter Torr (MS)

unread,
Jan 20, 2004, 11:43:08 AM1/20/04
to
"Rashad Rivera" <rashadrivera...@hotmail.NOSPAMcom> wrote in
message news:05d601c3db21$90b76e50$a501...@phx.gbl...

> 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

--
Please post questions to the newsgroup - everyone benefits.
This post is provided "AS IS" with no warranties, and confers no rights
Sample code subject to http://www.microsoft.com/info/cpyright.htm
Office / Security / Random weblog -- http://weblogs.asp.net/ptorr


0 new messages