简体   繁体   中英

How do I create an activeX component for a desktop application in C#

I need to create a plug-in (with GUI) for an application that loads them as activeX components (the joy of legacy systems). I've done some googling, but while I can find multiple examples of how to create an activeX component for a web page I can't find any examples for the desktop equivalent.

You should start with a new Windows Forms Control Library - Project.

In the project-properties dialog, section for your application, click on [Assembly Information ...].

Then you will see a checkbox: Make assembly COM visible. Check this option on.

This is equivalent to having

[assembly: ComVisible(true)]

in AssemblyInfo.cs. All your (public) user-controls should be accessible eg in VB6 projects.

I didn't expect so much trouble as discussed here

The main point seems to be: regsvr32 is useless for .net-dlls. you should go with regasm.exe

This question is a bit old, but... I was looking for answers to the very same problem. Namely, I'm trying to write a driver that ties into an older app via an ActiveX control. As a last ditch effort I was wading through msdn and found a link to "All-in-one code framework." Among the dozens of samples is one for CSActiveX . It answered a lot of my questions so I thought I'd share.

One note about the sample it requires a pre-build event so make sure and correct it to point to your copy of rc.exe. I needed to change it for vs2010 anyways.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM