Silverlight Student
Silverlight Student

Reputation: 4118

Steps for calling COM DLL API in my C# code

I have got a native DLL that I wanted to use via COM in my .NET/C# project. I am a little confused on the steps to follow in order to use it in my C# project. Here is what I understand, please correct me wherever I am wrong.

  1. Register COM DLL on the machine using regsvr32.
  2. Somehow get the interop DLL(RCW) from that native DLL. Not sure how to do that?
  3. Add reference to interop DLL in .NET/C# project
  4. Starting referencing calls from COM dll.

Upvotes: 2

Views: 2613

Answers (1)

Kieren Johnstone
Kieren Johnstone

Reputation: 42003

If it is a COM component (it has to be designed and compiled as such), you can add a COM reference using the Add Reference dialog; you will then have wrapper classes created for you.

If you are simply using a native DLL (not a COM component), you need to use DllImport to call native methods.

Upvotes: 2

Related Questions