Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Delcaring APIs! 1

Status
Not open for further replies.

Antzz

Programmer
Jan 17, 2001
298
US
Hey Guys,
Remember how we used to declare Win APIs in VB? Something like(This one is a custom API) :
Declare Function GDSOpenDB Lib "GDS132N.DLL" (ByVal lpGDScb As Long) As Integer

Can you suggest anything equivalent in C#?

Thanks and appreciate it
 
I copied this stuff off the Microsoft.Public newsgroups:

I've seen two types of declarations:

Clear:
[DllImport["kernel32.dll", CharSet=CharSet.Auto)]
private static extern int GetDriveType(string nDrive);

and Unclear (to me at least):

[DllImport("user32.dll",CharSet=CharSet.Auto)]
private static extern IntPtr FindWindow([MarshalAs(UnmanagedType.LPTStr)] string lpClassName[MarshalAs(UnmanagedType.LPTStr)] string lpWindowName);



Brian
"There are 2 kinds of people in the world, those that divide people into two groups and those that don't. I belong to the second group." - tag line I stole
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top