For one of a side-projects i need to write a C# app that required to use a third-party INPROC COM object. Unfortunately, C# is not my primary programming language, so my knowledge is a bit limited. Is it any good tutorials available on how to access COM object from C#? The usage of this third-party COM object requires me to create implementation of specified COM interface and supply that implementation into COM object in order for it to function.
相关问题
- Sorting 3 numbers without branching [closed]
- Graphics.DrawImage() - Throws out of memory except
- Why am I getting UnauthorizedAccessException on th
- 求获取指定qq 资料的方法
- How to know full paths to DLL's from .csproj f
The basics are pretty straightforward, and MSDN has good reference information.
In your C# project, use "Add Reference" to add a reference to the COM component.
If you need to implement a COM interface, create a class that inherits from it:
I have quite a large .NET <-> COM bookmark collection that I'm dumping below.
The problem is that no one tutorial/article covers all the basics and gotacha's. So you need to go through a couple of them and mix and match, depending on what you want to do.
Here's the best of what I've found so far...
General .NET COM Articles/Tutorials
MSDN on .NET & COM
ActiveX in .NET
Maybe this is useful for you: http://msdn.microsoft.com/en-us/library/aa645736%28VS.71%29.aspx
There is a good book called .NET and COM: The Complete Interoperability Guide that I am about to start reading as I want a better understanding of COM interop. Maybe it would be useful for you too, check it out.
Also have a look at this (legally) free pdf ebook COM and .NET Interoperability which you can download from TheServerSide.com. You have to register before you can download, but you can just bugmenot if you don't feel like it.