I don’t have any previous experience creating ActiveX-Controls. Information about the topic thats not older than 2008 is very scarce, is outdated and often doesn’t help at all.
What I have to do:
Create a website that displays detailed client system information (stuff like available HDD space and exactly what CPU and so on). All this must be possible without downloading/installing anything (must run on a fresh install of XP SP2). They consider ActiveX as not downloading something so that seems to be the only way to solve this problem. I am well aware of how stupid this is to cross the border between browser/client and how unsecure ActiveX is, but I don’t have a say in this.
What I came up with:
Write an invisible ActiveX control that provides functions that are to be called by javascript and return a string. All the control does is when a function is called look up the requested information via WMI and return it as a string back to javascript that then writes the result on the page (so theres no need for the control to influence the web page).
My actual question:
Whats the easiest way to accomplish this? I know C#, Java, C++. C# and Java wouldn’t work because they require stuff to be downloaded/installed (.NET/JVM). C++ it seems to be very confusing writing an ActiveX control via MFC. I found this but it seems overly complex with all the GUI and gif stuff. It doesn’t show how to just expose functions to be used via javascript. Anyone know a tutorial for that?
Another option would be to use VB but it seems VS2010 doesn’t offer a template for creating ActiveX controls.
So..whats the simplest way of exposing functions to be used by javascript in C++ or maybe VB?
The codeproject link that you point out is a very good example for creating an activex control. Remeber even in c++, the browser will try to download and install the ActiveX control for the first time.
You can create an MFC ActiveX control and comment the code in OnPaint. Then you can create function in your idl file like
and in the class file that derives the COleControl. Then you can implement your function in your cpp file.