Tasneem Ahmed
Tasneem Ahmed

Reputation: 11

How can I use other software DLLs in my C# application?

How can I use third-party software DLLs in my C# Windows application?

Upvotes: 1

Views: 1641

Answers (3)

froeschli
froeschli

Reputation: 2880

Basically you need to add a reference to the DLL in your project and add a using statement, which declares the namespace of the classes you wish to use...

EDIT: Adding references to third party DLLs using Visual Studio 2008:

  • in VS2008 open the project folder
  • right click on the References Folder
  • click add Reference
  • select the Browse tab
  • go to the DLL you wish to reference
  • select it and click ok

Upvotes: 1

PHeiberg
PHeiberg

Reputation: 29801

It depends on what the dll contains. If it's a .NET assembly you can add a reference to it and compile your project against that assembly.

If it's a COM component you will have to expose the component to .NET by creating a Runtime Callable Wrapper. Visual studio does this automatically for you if you add a reference to a COM component.

If it's a dll with a C style API you have to use Platform Invocation (PInvoke) in order to call functions inside it.

Upvotes: 4

Umesh CHILAKA
Umesh CHILAKA

Reputation: 1466

If it is a dll u cannot start using process.start if it is a unmanaged dll u have to use DllImport otherwise reference it to ur project and use their methods

Upvotes: 1

Related Questions