Click here to Skip to main content
12,509,269 members (57,228 online)
Rate this:
 
Please Sign up or sign in to vote.
See more: C# VB ActiveX
I am converting an old desktop application that uses 2 ActiveX EXE's. It uses CreateObject() to return a reference to the COM object. This reference is then used to pass in pertinent information to the COM component such as database connection information and call the appropriate fuctions. There is no need to use this in IE. It is only used from this desktop app.

What would be a way to do this in .Net using C#.
Posted 19-Dec-12 6:38am
rshepp143

1 solution

Rate this: bad
 
good
Please Sign up or sign in to vote.

Solution 1

Right click References, Add Reference
select the COM tab in the dialog box and locate your activeX object - I'll call mine objA for now - and hit Ok. objA should appear in your list of references.

In your code you will need to put
using objA;

Then you can use it like any other object e.g.

objA a = new objA();
Debug.Print(objA.aMember.ToString());

When you build your project you will get an additional file called Interop.objA.dll which will need to live in the same folder as your exe

I've successfully used this approach with several legacy VB6 COM DLLs and EXEs - but apologies for any typos!
  Permalink  
Comments
rshepp 19-Dec-12 15:37pm
   
These ActiveX EXE's are going to have to be re-written for a number of reasons... The most pressing being that I cannot get them to work on the 2008 Terminal Server that I am trying to get them to work on. I would like to modernize them if at all possible and I am trying to determine the best way to do that.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month


Advertise | Privacy | Mobile
Web02 | 2.8.160927.1 | Last Updated 19 Dec 2012
Copyright © CodeProject, 1999-2016
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100