Win32 Types
|
Specification
|
CLR Type
|
char, INT8, SBYTE, CHARâ€
|
8-bit signed integer
|
System.SByte
|
short, short int, INT16, SHORT
|
16-bit signed integer
|
System.Int16
|
int, long, long int, INT32, LONG32, BOOL†, INT
|
32-bit signed integer
|
System.Int32
|
__int64, INT64, LONGLONG
|
64-bit signed integer
|
System.Int64
|
unsigned char, UINT8, UCHAR†, BYTE
|
8-bit unsigned integer
|
System.Byte
|
unsigned short, UINT16, USHORT, WORD, ATOM, WCHAR†, __wchar_t
|
16-bit unsigned integer
|
System.UInt16
|
unsigned, unsigned int, UINT32, ULONG32, DWORD32, ULONG, DWORD, UINT
|
32-bit unsigned integer
|
System.UInt32
|
unsigned __int64, UINT64, DWORDLONG, ULONGLONG
|
64-bit unsigned integer
|
System.UInt64
|
float, FLOAT
|
Single-precision floating point
|
System.Single
|
double, long double, DOUBLE
|
Double-precision floating point
|
System.Double
|
†In Win32 this type is an integer with a specially assigned meaning; in contrast, the CLR provides a specific type devoted to this meaning.
|
using System; using System.Runtime.InteropServices; public class MSSQL_ServerHandler { [DllImport("kernel32.dll")] public static extern int GetShortPathName ( string path, StringBuilder shortPath, int shortPathLength ) }
using System; using System.Runtime.InteropServices; public class MSSQL_ServerHandler { [DllImport("kernel32.dll", CharSet = CharSet.Auto)] public static extern int GetShortPathName ( [MarshalAs(UnmanagedType.LPTStr)] string path, [MarshalAs(UnmanagedType.LPTStr)] StringBuilder shortPath, int shortPathLength ) }
[DllImport("kernel32.dll", EntryPoint="getShort")]
[DllImport]
虽等效于
[DllImportAttribute]
,但
DllImportAttribute 才是该属性在 .NET Framework 中的实际名称。
本文出自 “锉人Kris” 博客,请务必保留此出处http://chris.blog.51cto.com/112473/29285