I have a 3rd party DLL that needs to be called as COM. It is not COM, but it is a .NET DLL. Are there any utilities that will auto generate a CCW for it? Rather than making on开发者_JAVA百科e by hand?
Visual Studio includes a program called "tlbexp", the Type Library exporter. This takes a .NET assembly and generates a COM type library out of it, which you can then import into a COM-based development tool like VB6. You can also use the "regasm" tool on your assembly, which will export a type library and automatically register it on the machine.
All of this assumes that the third-party .NET DLL was written with COM in mind; the types need to be COM-visible for the exporter to pick them up. Also, unless the assembly contains the interop attributes to control the typelib generation, you're gonna get some pretty rough-looking COM types (and really long ProgIds), but they should still work :)
精彩评论