-1

It is first time I am trying to use DllImort in C#. But it is not appearing in InteliSense. I have added

using System.Runtime.InteropServices;

But it is not working again. Instead this [DllImportAttribute] is shown.

What am I doing wrong?

gideon
  • 19,329
  • 11
  • 72
  • 113
Adil Mammadov
  • 8,476
  • 4
  • 31
  • 59

1 Answers1

0

You do nothing wrong. Use this attribute to define the managed signature for the method you want to import.

As Example

[DllImport("kernel32.dll", BestFitMapping = false, 
                CharSet = CharSet.Auto, SetLastError = true)]
private static extern IntPtr GetModuleHandle(string moduleName);

Look in MSDN for all possible parameter for DllImport

gideon
  • 19,329
  • 11
  • 72
  • 113
Manuel Amstutz
  • 1,311
  • 13
  • 33