Habits to write things with C #, but usually encounter a lot of places to use Win32 API, so often use DLLIMPORT, but the Win32 function type is very intense, I believe that the trouble is more than me, now I am sorting one My personal understanding is as follows, I hope that the seniors will be enlightened. My basic principle is as follows: 1, below is for 32-bit systems, so int is 32 digits .long is also 32 bits; 2, various handle (H starting), I think it is system.intptr I didn't find an error until there was an error. Please point out; 3, lp and p, I really don't understand (not understanding C ), the function of LP and P started, if it is related to STR , It is written as system.string, what is pointing like PLCID, written as system.uint32 (because pointing to another address, that is, the pointer is 32 digits), the value of int it is, then I will Write as int [] to facilitate .NET program reference (write to system.uint32, call the API call should not be wrong, but .net program is not good)
If there is any opinion, welcome to advise: appledgedotnet@hotmail.com
BOOL = System.Int32BOOLEAN = System.Int32BYTE = System.UInt16CHAR = System.Int16COLORREF = System.UInt32DWORD = System.UInt32DWORD32 = System.UInt32DWORD64 = System.UInt64FLOAT = System.FloatHACCEL = System.IntPtrHANDLE = System.IntPtrHBITMAP = System.IntPtrHBRUSH = System.IntPtrHCONV = System.IntPtrHCONVLIST = System.IntPtrHCURSOR = System.IntPtrHDC = System.IntPtrHDDEDATA = System.IntPtrHDESK = System.IntPtrHDROP = System.IntPtrHDWP = System.IntPtrHENHMETAFILE = System.IntPtrHFILE = System.IntPtrHFONT = System.IntPtrHGDIOBJ = System. IntPtrHGLOBAL = System.IntPtrHHOOK = System.IntPtrHICON = System.IntPtrHIMAGELIST = System.IntPtrHIMC = System.IntPtrHINSTANCE = System.IntPtrHKEY = System.IntPtrHLOCAL = System.IntPtrHMENU = System.IntPtrHMETAFILE = System.IntPtrHMODULE = System.IntPtrHMONITOR = System.IntPtrHPALETTE = System.IntPtrHPEN = System.IntPtrHRGN = System.IntPtrHRSRC = System.IntPtrHSZ = System.IntPtrHWINSTA = System.IntPtrHWND = System.IntPtrINT = System.Int32INT32 = System.Int32INT64 = System.Int64LONG = System.Int32LONG32 = System.Int32LONG64 = System. INT64LONGLONG = System. Int64LPARAM = System.IntPtrLPBOOL = System.Int16 [] LPBYTE = System.UInt16 [] LPCOLORREF = System.UInt32 [] LPCSTR = System.StringLPCTSTR = System.StringLPCVOID = System.UInt32LPCWSTR = System.StringLPDWORD = System.UInt32 [] LPHANDLE = System.UInt32LPINT = System.Int32 [] LPLONG = System.Int32 [] LPSTR = System.StringLPTSTR = System.StringLPVOID = System.UInt32LPWORD = System.Int32 [] LPWSTR = System.StringLRESULT = System.IntPtrPBOOL = System.Int16 [] Pboolean = system.int16 [] pbyte = system.uint16 [] PCHAR =
System.Char [] PCSTR = System.StringPCTSTR = System.StringPCWCH = System.UInt32PCWSTR = System.UInt32PDWORD = System.Int32 [] PFLOAT = System.Float [] PHANDLE = System.UInt32PHKEY = System.UInt32PINT = System.Int32 [] PLCID = System.UInt32PLONG = System.Int32 [] PLUID = System.UInt32PSHORT = System.Int16 [] PSTR = System.StringPTBYTE = System.Char [] PTCHAR = System.Char [] PTSTR = System.StringPUCHAR = System.Char [ ] PUINT = System.UInt32 [] PULONG = System.UInt32 [] PUSHORT = System.UInt16 [] PVOID = System.UInt32PWCHAR = System.Char [] PWORD = System.Int16 [] PWSTR = System.StringREGSAM = System.UInt32SC_HANDLE = System.IntPtrSC_LOCK = System.IntPtrSHORT = System.Int16SIZE_T = System.UInt32SSIZE_ = System.UInt32TBYTE = System.CharTCHAR = System.CharUCHAR = System.ByteUINT = System.UInt32UINT32 = System.UInt32UINT64 = System.UInt64ULONG = System.UInt32ULONG32 = System. Uint32ulong64 = system.uint64ulonglong = system.uint64USHORT = system.uint16word = system.uint16wparam = system.intptr Attached: Establish an example of a declaration API
[DllImport ( "Kernel32.dll")] public static extern System.UInt32 VirtualAllocEx (System.IntPtr hProcess, System.UInt32 lpAddress, System.UInt32 dwSize, System.UInt32 flAllocationType, System.UInt32 flProtect);