We help IT Professionals succeed at work.

Check out our new AWS podcast with Certified Expert, Phil Phillips! Listen to "How to Execute a Seamless AWS Migration" on EE or on your favorite podcast platform. Listen Now

x

How do I create a DLL to interface with JavaScript

4fingers
4fingers asked
on
Medium Priority
369 Views
Last Modified: 2012-06-27
I am new to DLL development so I followed the following tutorial on how I can create a COM DLL along with a Win32 application that calls its functions:
The Simplest COM Tutorial in Visual Studio 2008

This all worked as expected but my ultimate goal is to run the DLL from a scripting interface like JavaScript e.g.
try {
    var app = new ActiveXObject("SimpleCOM.SimpleChatServer.1");
    app.CallMe("Test 1","Test 2");
}
catch (e) {
    alert("Error: " +e.message);
}

Open in new window

The following example just returns the following error message:
"Error: 'app' is null or not an object"

I am also aware that the DLL needs to be registered which Visual Studio 2008 seems to do automatically. Using RegDllView I was able to see the DLL listed (Sorry for the lack of formatting)
Class ID       Name       ProgID       Control       Version       Threading Model       Last Write Time
{3C32480D-2799-41EC-8E9F-6CBFFC20D51B}      SimpleChatServer Class      SimpleCOM.SimpleChatServer.1      No             Apartment      19/04/2011 19:42:12

Does any one know what further steps are required so it can start interfacing with it via JavaScript e.g. allowing me to call setters and getters from within the DLL file.

Thanks
Comment
Watch Question

Commented:
Unlock this solution and get a sample of our free trial.
(No credit card required)
UNLOCK SOLUTION

Commented:
for a brief introduction to early binding and late binding read here:
http://support.microsoft.com/kb/245115/en-us

Author

Commented:
I decided to create a new ATL project and I made sure "Support COM+ 1.0" was checked. Then when I came to creating a new class I enssured the "ATL Simple Object Wizard" had the "Interface" set to "Dual".
Unlock the solution to this question.
Thanks for using Experts Exchange.

Please provide your email to receive a sample view!

*This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

OR

Please enter a first name

Please enter a last name

8+ characters (letters, numbers, and a symbol)

By clicking, you agree to the Terms of Use and Privacy Policy.