Building an OCX with VS.NET?

你离开我真会死。 提交于 2019-12-04 09:34:19

Yes, you can still create them. But you can't create an OCX with a .NET language. Need to be unmanaged C++ (or VB). The DLLs with COM interop you can create in C# or VB.NET are just .NET objects that are invoked via CCW.

You can still use .NET to create ActiveX components. However, this is experimental and not recommended. If you still want to try it you can find information in the blog of Andrew Whitechapel:

Using Managed Controls as ActiveX Controls

But as Andrew says:

This seems to work OK for Excel (with the very limited testing I've done), partly works with PowerPoint, but fails miserably with Word.

So if you don't want to spend a lot of time debugging strange errors I would recommend you to use the old VB 6.0 and Visual Studio 6.0 to build you ActiveX components.

Use a C++ or VB compiler which can target native code + ActiveX.

Depending on what you need to do, an Add-in may be more appropriate than an OCX, and you can certainly create those with .NET. You should also look at the Visual Studio Tools for Office, not as a direct replacement for an OCX, but only to understand the new capabilities. It may show you new approaches to the problems you're now solving with an OCX.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!