Welcome to MSDN Blogs Sign in | Join | Help

Interoperability of JScript with COM

Recently I worked on using COM component in JScript. I couldn't find one stop solution or example for this and so thought for writing series of posts regarding this.

 

Instantiating a COM class.

COM class should implement IDispatch and be registered with ProgID, so that JScript can invoke it using ActiveXObject semantics.

 

I used ATL library to create a ATL project called Sample and then added the Test which implements IDispatch and has progID = “Sample.Test”

 

Register this class using command

regsvr32 <path>Sample.dll

 

Now this class can be instantiated in JScript using:

var x = new ActiveXObject(“Sample.Test”);

 

Methods of Class Test can be invoked now using variable x.

I will talk about different mechanisms for passing parameters to and fro in next Posts.

 

Attached Zip contains the sample code.

Published Thursday, August 09, 2007 6:20 PM by Sheetal Kamat
Filed under: , ,

Attachment(s): Sample.zip

Comment Notification

If you would like to receive an email when updates are made to this post, please register here

Subscribe to this post's comments using RSS

Comments

# JScript COM interop...

Here are links to a virtual series written by Sheetal, one of the developers in the JScript team on Jscript

Tuesday, September 25, 2007 12:30 PM by Gaurav Seth's WebLog

Leave a Comment

(required) 
required 
(required) 
 
Page view tracker