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 deskt开发者_运维问答op 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 e.g. 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.
精彩评论