Can I use ActiveX to embed my C++ application into a web page?

Posted on 2005-04-06
Last Modified: 2010-04-24
Hello all,

I've had some experience with C++ in the past, but unfortunately almost no experience at all with VC++ .NET, which is what I've got to use for a project I've been handed.

Currently, the application pops up as a windows dialog box to perform a number of functions. One request for this project was to embed that application into a web page if possible. Now, the only way I think that could be possible is using ActiveX (which I haven't really worked with either).

My question is...can I have a windows-style dialog box within a web page via ActiveX? And most importantly, can I do it within VC++ .NET?

Any suggestions and/or examples would be much appreciated, I'm trying to get this ported over asap if possible, and I need some crash-coursing fast.

Many thanks.
Question by:Inward_Spiral
    LVL 9

    Accepted Solution

    Well, it's not as simple as that.

    First of all, if you have access to the source code for the application, and depending what technologies it uses, it can be modified to be hosted in an ActiveX. This may be more or less difficult, depending on the technologies, but more often than not it is not an easy task.

    Secondly, if you're happy with the ActiveX to display a Windows dialog box, that's fine. If you want the dialog box itself to be embedded in the web page, you have to convert it to something like a form - again, it depends how the dialog was implemented in the first place.

    Is the application a .NET app, an MFC app, or what?
    Finally, you may have security issues if the app accesses local system resources (e.g. Registry, files, etc). You may also have security issues if the app talks to COM components. When you’re hosting the ActiveX on a web page, it will run in the security context of the browser (e.g. Internet Explorer). You will not be able to alter the COM/OLE security settings from the DLL.



    Author Comment

    Sorry for the late reply, Radu.

    I was pretty sure it wouldn't be all that easy, but I had to ask. The application is really VC++ 6.0 source that I "upgraded" into a .NET application.
    I know there would definitely be security issues to face...I'm not a fan of ActiveX by any stretch, but I've got to be able to access certain dlls from IE.


    Author Comment

    Update: I'm currently trying to implement it by creating the project as a .NET "Windows Control Library".  
    That way, I can implement it as a UserControl (System::Windows::Forms::UserControl), and reference the compiled dll via a web page:
                <OBJECT id="myID" height="275" width="425" classid="http:bin/Debug/CPlusApp.dll#CPlusApp.UserControl1"

    I don't think this is ActiveX per se, but I think this could serve the purpose if I can get it it run. Unfortunately, I haven't been able to get that to initialize properly yet. I can this to work fine if I'm working from C#, but something's different when I try this in VC++.

    If I'm trying to reference my C++ dll via a web page, do I need to specifically initialize something to get a UserControl to run from IE?

    Author Comment

    Thanks for posting this, TheLearnedOne.

    I still haven't found a way to do what I want in ActiveX, so right now I'm researching ways to emulate a workaround thru Java.
    No clear-cut solution yet.

    I'm awarding Radu the points, he brought up some points that steered me in my current direction.

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    What Security Threats Are You Missing?

    Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

    The following diagram presents a diamond class hierarchy: As depicted, diamond inheritance denotes when two classes (e.g., CDerived1 and CDerived2), separately extending a common base class (e.g., CBase), are sub classed simultaneously by a fourt…
    In Easy String Encryption Using CryptoAPI in C++ ( I described how to encrypt text and recommended that the encrypted text be stored as a series of hexadecimal digits -- because cyphertext may…
    Need more eyes on your posted question? Go ahead and follow the quick steps in this video to learn how to Request Attention to your question. *Log into your Experts Exchange account *Find the question you want to Request Attention for *Go to the e…
    how to add IIS SMTP to handle application/Scanner relays into office 365.

    737 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    22 Experts available now in Live!

    Get 1:1 Help Now