Platform Invoke Data Types
The following table lists data types used in the Win32 API (listed in Wtypes.h) and C-style functions. Many unmanaged libraries contain functions that pass these data types as parameters and return values. The third column lists the corresponding .NET Framework built-in value type or class that you use in managed code. In some cases, you can substitute a type of the same size for the type listed in the table.
Unmanaged type in Wtypes.h |
Unmanaged C language type |
Managed class name |
Description |
---|---|---|---|
HANDLE |
void* |
32 bits on 32-bit Windows operating systems, 64 bits on 64-bit Windows operating systems. |
|
BYTE |
unsigned char |
8 bits |
|
SHORT |
short |
16 bits |
|
WORD |
unsigned short |
16 bits |
|
INT |
int |
32 bits |
|
UINT |
unsigned int |
32 bits |
|
LONG |
long |
32 bits |
|
BOOL |
long |
32 bits |
|
DWORD |
unsigned long |
32 bits |
|
ULONG |
unsigned long |
32 bits |
|
CHAR |
char |
Decorate with ANSI. |
|
LPSTR |
char* |
Decorate with ANSI. |
|
LPCSTR |
Const char* |
Decorate with ANSI. |
|
LPWSTR |
wchar_t* |
Decorate with Unicode. |
|
LPCWSTR |
Const wchar_t* |
Decorate with Unicode. |
|
FLOAT |
Float |
32 bits |
|
DOUBLE |
Double |
64 bits |
For corresponding types in Visual Basic 2005, C#, and C++, see the Introduction to the .NET Framework Class Library.
See Also
Concepts
Marshaling Classes, Structures, and Unions
Miscellaneous Marshaling Samples