ActiveX help

I originally posted this on MicrosoftGadgets.com but I don't think I can reply there anymore.

Basically, I want to create a gadget that uses my online web service, but I don't want the location (or password) visible in the source code for my Gadget. What I really want to do is create an ActiveX component that will make the call and return the XML (or even better, parse the XML to HTML) to the gadget.

Problem is, I have no idea where to start when it comes to ActiveX programming, can anyone help?

Andy

[552 byte] By [AndyE] at [2008-2-4]
# 1
What languages do you know?
Tomfromcener.co.uk at 2007-9-3 > top of Msdn Tech,Gadgets,Sidebar Gadget Development...
# 2
VB6 is the easiest method I've found to create a COM. It's available for download on MSDN. You could probably do it via Visual Studio as well, perhaps someone could tell you how to do it via that.

With VB6, all you have to do is:

1. Create a new "ActiveX DLL" project
2. Give it a Project Name via Project\Project1 Properties (the default name will be Project1)
3. Rename the default Class Module from "Class1" to your own name (in the "Project - <Project Name>" pane)
4. Stick "Public" on the front of all your outward facing functions/procedures.

To compile it select "File/Make <Project Name>.DLL". Then all you need to do is add some code in the Gadget to register/unregister it, see my earlier post on the subject for the code. VB6 will auto register it under HKLM on the machine you're compile it on.

In your code, initialise the DLL via:

var myLib = new ActiveXObject("<Project Name>.<Class Name>");

Then to call your functions/procedures the syntax will be:

myLib.<myfunction>([<param1>, [<paramN>])

To register/unregister you'll need to find the three keys for the DLL under HKLM and translate them to HKCU, as in my example code in the other post:

HKLM\\Software\\Classes\\CLSID\\<Class GUID>
HKLM\\Software\\Classes\\<Proejct Name>.<Class Name>
HKLM\\Software\\Classes\\TypeLib\<TypeLib GUID>

JonathanAbbott at 2007-9-3 > top of Msdn Tech,Gadgets,Sidebar Gadget Development...
# 3

Tom, I'm not really great with any 'hardcore' programming languages like C++ or VB. I did a lot of VB when I was younger, but I'll be damned if I can remember any of it. I'm more of a web coder than anything else. Most of the stuff I do is PHP, JS and HTML.

However, Jonathan's managed to point me in the right direction. As I did a lot of VB when I was younger, I'm hoping it hasn't changed too dramatically and it's not too difficult to get back into.

Thanks for your help.

-A

AndyE at 2007-9-3 > top of Msdn Tech,Gadgets,Sidebar Gadget Development...