Recent research on POS printer-related features, call WINAPI, and cross-process communication involves conversions between types.
C + + |
C# |
HANDLE, Lpdword, LPVOID, void* |
IntPtr |
LPCTSTR, LPCTSTR, LPSTR, char*, const char*, wchar_t*, LPWSTR |
String [in], StringBuilder [in, out] |
DWORD, unsigned long, Ulong |
UInt32, [MarshalAs (UNMANAGEDTYPE.U4)] |
bool |
bool |
Lp<struct> |
[In] ref <struct> |
size_t |
UInt |
Lpdword |
Out UINT |
LPTSTR |
[out] StringBuilder |
Pularge_integer |
Out ULONG |
Word |
UInt16 |
Byte, unsigned char |
Byte |
Short |
Int16 |
Long, int |
Int32 |
Float |
Single |
Double |
Double |
NULL pointer |
IntPtr.Zero |
Uint |
Uint32 |
Windows Data Type |
. NET Data Type |
BOOL, BOOLEAN |
Boolean or Int32 |
BSTR |
String |
BYTE |
Byte |
CHAR |
Char |
DOUBLE |
Double |
DWORD |
Int32 or UInt32 |
FLOAT |
Single |
HANDLE (and all other HANDLE types, such as Hfont and HMENU) |
INTPTR, UINTPTR or HandleRef |
HRESULT |
Int32 or UInt32 |
Int |
Int32 |
LANGID |
Int16 or UInt16 |
Lcid |
Int32 or UInt32 |
LONG |
Int32 |
LPARAM |
INTPTR, UINTPTR or Object |
LPCSTR |
String |
Lpctstr |
String |
Lpcwstr |
String |
LPSTR |
String or stringbuilder* |
LPTSTR |
String or StringBuilder |
LPWStr |
String or StringBuilder |
LPVoid |
INTPTR, UINTPTR or Object |
LRESULT |
IntPtr |
SAFEARRAY |
. NET Array Type |
Short |
Int16 |
TCHAR |
Char |
UCHAR |
SByte |
UINT |
Int32 or UInt32 |
ULONG |
Int32 or UInt32 |
VARIANT |
Object |
Variant_bool |
Boolean |
WCHAR |
Char |
Word |
Int16 or UInt16 |
WPARAM |
INTPTR, UINTPTR or Object |
Wtypes.h the unmanaged type in |
unmanaged C language Types |
Managed class name |
Description |
HANDLE |
void* |
System.IntPtr |
32-bit on 32-bit Windows operating system, 64-bit on 64-bit Windows operating system. |
BYTE |
unsigned char |
System.Byte |
8 Guests |
Short |
Short |
System.Int16 |
16 Guests |
Word |
unsigned short |
System.UInt16 |
16 Guests |
Int |
Int |
System.Int32 |
32 Guests |
UINT |
unsigned int |
System.UInt32 |
32 Guests |
LONG |
Long |
System.Int32 |
32 Guests |
BOOL |
Long |
System.Int32 |
32 Guests |
DWORD |
unsigned long |
System.UInt32 |
32 Guests |
ULONG |
unsigned long |
System.UInt32 |
32 Guests |
CHAR |
Char |
System.Char |
Decorated with ANSI. |
LPSTR |
char* |
System.String or System.Text.StringBuilder |
Decorated with ANSI. |
LPCSTR |
Const char* |
System.String or System.Text.StringBuilder |
Decorated with ANSI. |
LPWStr |
wchar_t* |
System.String or System.Text.StringBuilder |
Decorated with Unicode. |
Lpcwstr |
Const wchar_t* |
System.String or System.Text.StringBuilder |
Decorated with Unicode. |
FLOAT |
Float |
System.Single |
32 Guests |
DOUBLE |
Double |
System.Double |
64 guests |
The correspondence between C + + and C # types