Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 509
  • Last Modified:

dll file to c#

how can I import a dll file to c# execute file?
I tried add to system but I couldn't. It is not accepting.
I tried the reflector...
How?
Thanks.
0
fancyfanta
Asked:
fancyfanta
1 Solution
 
Fernando SotoRetiredCommented:
If this is a .Net dll file just add a reference to the dll file from within Solution Explorer References node and then add a using statement to your code file.
0
 
systanCommented:
hi

use;
using System.Runtime.InteropServices;

sample;

[DllImportAttribute("user32.dll")] //DLL NAME
public static extern int SendMessage(IntPtr hWnd, int Msg, int wParam, int lParam); //DLL FUNCTION NAME TO BE USED

[DllImportAttribute("user32.dll")] //DLL NAME
public static extern bool ReleaseCapture(); //DLL FUNCTION NAME TO BE USED


The rest of the code is here;
http://www.experts-exchange.com/blogs/systan/B_3780-Drag-any-object-in-the-form-including-the-form-body.html

Open in new window

0
 
Russell_VenableCommented:
You may need to run it through OllyDbg and find the method through function list. This is a sure way to find out what it uses and sometimes the names and then you can use systan's example to import the functions.
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Tackle projects and never again get stuck behind a technical roadblock.
Join Now