Windows Data Types and Data Type Ranges
Data Type Ranges
Type name Bytes Other Names Range of Values
int * signed,signed int System dependent
unsigned int * unsigned System dependent
__int8 1 char,signed char -128 to 127
__int16 2 short,short int,signed short int -32,768 to 32,767
__int32 4 signed,signed int -2,147,483,648 to 2,147,483,647
__int64 8 none –9,223,372,036,854,775,808 to 9,223,372,036,854,775,807
bool 1 none false or true
char 1 signed char -128 to 127
unsigned char 1 none 0 to 255
short 2 short int,signed short int -32,768 to 32,767
unsigned short 2 unsigned short int 0 to 65,535
long 4 long int,signed long int –2,147,483,648 to 2,147,483,647
long long 8 none (but equivalent to __int64) –9,223,372,036,854,775,808 to 9,223,372,036,854,775,807
unsigned long 4 unsigned long int 0 to 4,294,967,295
enum * none Same as int
float 4 none 3.4E +/- 38 (7 digits)
double 8 none 1.7E +/- 308 (15 digits)
long double same as double none same as double
wchar_t 2 __wchar_t 0 to 65,535
一个__wchar_t变量指定一个宽字符或多字节字符类型,通过默认wchar_t为unsigned short 的声明,使用L作为一个字符或字符串常量的前缀来指定宽字符类型的常量。
当编译使用/ Zc:wchar_t的或/ ZA,编译器可以区分的unsigned short和wchar_t的函数重载的目的。
ATOM typedef WORD ATOM; //Atom. For more information, see Atoms.
BOOL typedef int BOOL;//Boolean variable (should be TRUE or FALSE).
BOOLEAN typedef BYTE BOOLEAN;//Boolean variable (should be TRUE or FALSE).
BYTE typedef unsigned char BYTE;//Byte (8 bits).
CALLBACK #define CALLBACK __stdcall //Calling convention for callback functions.
CHAR typedef char CHAR;//8-bit Windows (ANSI) character. For more information, see Character Sets Used By Fonts.
COLORREF typedef DWORD COLRREF;//Red, green, blue (RGB) color value (32 bits). See COLORREF for information on this type.
CONST #define CONST const; //Variable whose value is to remain constant during execution.
DWORD typedef unsigned long DWORD; //32-bit unsigned integer.
DWORDLONG typedef ULONGLONG DWORDLONG; //64-bit unsigned integer.
DWORD_PTR typedef ULONG_PTR DWORD_PTR; //Unsigned long type for pointer precision. Use when casting a pointer to a long type to perform pointer arithmetic. (Also commonly used for general 32-bit parameters that have been extended to 64 bits in 64-bit Windows. )
DWORD32 typedef unsigned int DWORD32; //32-bit unsigned integer.
DWORD64 typedef unsigned __int64 DWORD64; //64-bit unsigned integer.
FLOAT typedef float FLOAT; //Floating-point variable.
HACCEL typedef HANDLE HACCEL;//Handle to an accelerator table.
HALF_PTR #ifdef _WIN64 //Half the size of a pointer. Use within a structure that contains a pointer and two small fields.
typedef int HALF_PTR;
#else
typedef short HALF_PTR;
#endif
HANDLE typedef PVOID HANDLE; //Handle to an object.
HBITMAP typedef HANDLE HBITMAP; //Handle to a bitmap.
HBRUSH typedef HANDLE HBRUSH; //Handle to a brush.
HCOLORSPACE #if(WINVER >= 0x0400) //Handle to a color space.
typedef HANDLE HCOLORSPACE;
#endif
HCONV typedef HANDLE HCONV; //Handle to a dynamic data exchange (DDE) conversation.
HCONVLIST typedef HANDLE HCONVLIST;//Handle to a DDE conversation list.
HCURSOR typedef HICON HCURSOR; //Handle to a cursor.
HDC typedef HANDLE HDC; //Handle to a device context (DC).
HDDEDATA typedef HANDLE HDDEDATA; //Handle to DDE data.
HDESK typedef HANDLE HDESK; //Handle to a desktop.
HDROP typedef HANDLE HDROP; //Handle to an internal drop structure.
HDWP typedef HANDLE HDWP;//Handle to a deferred window position structure.
HENHMETAFILE typedef HANDLE HDWP;//Handle to an enhanced metafile.
HFILE typedef int HFILE;//Handle to a file opened by OpenFile, not CreateFile.
HFONT typedef HANDLE HFONT;//Handle to a font.
HGDIOBJ typedef HANDLE HGDIOBJ;//Handle to a GDI object.
HGLOBAL typedef HANDLE HGLOBAL;//Handle to a global memory block.
HHOOK typedef HANDLE HHOOK;//Handle to a hook.
HICON typedef HANDLE HICON;//Handle to an icon.
HINSTANCE typedef HANDLE HINSTANCE;//Handle to an instance.
HKEY typedef HANDLE HKEY;//Handle to a registry key.
HKL typedef HANDLE HKL;//Input locale identifier.
HLOCAL typedef HANDLE HLOCAL;//Handle to a local memory block.
HMENU typedef HANDLE HMENU;//Handle to a menu.
HMETAFILE typedef HANDLE HMETAFILE;//Handle to a metafile.
HMODULE typedef HINSTANCE HMODULE;//Handle to a module. The value is the base address of the module.
HMONITOR if(WINVER >= 0x0500) typedef HANDLE HMONITOR;//Handle to a display monitor.
HPALETTE typedef HANDLE HPALETTE;//Handle to a palette.
HPEN typedef HANDLE HPEN;//Handle to a pen.
HRESULT typedef LONG HRESULT;//Return code used by interfaces. It is zero upon success and nonzero to represent an error code or status information.
HRGN typedef HANDLE HRGN;//Handle to a region.
HRSRC typedef HANDLE HRSRC;//Handle to a resource.
HSZ typedef HANDLE HSZ;//Handle to a DDE string.
HWINSTA typedef HANDLE WINSTA;//Handle to a window station.
HWND typedef HANDLE HWND;//Handle to a window.
INT typedef int INT;//32-bit signed integer.
INT_PTR #if defined(_WIN64) //Signed integer type for pointer precision. Use when casting a pointer to an integer to perform pointer arithmetic.
typedef __int64 INT_PTR;
#else
typedef int INT_PTR;
#endif
INT32 typedef signed int INT32;//32-bit signed integer.
INT64 typedef signed __int64 INT64;//64-bit signed integer.
LANGID typedef WORD LANGID;//Language identifier. For more information, see Locales.
LCID typedef DWORD LCID;//Locale identifier. For more information, see Locales.
LCTYPE typedef DWORD LCTYPE;//Locale information type. For a list, see Locale and Language Information.
LGRPID typedef DWORD LGRPID;//Language group identifier. For a list, see EnumLanguageGroupLocales.
LONG typedef long LONG;//32-bit signed integer.
LONGLONG #if !defined(_M_IX86)//64-bit signed integer.
typedef __int64 LONGLONG;
#else
typedef double LONGLONG;
#endif
LONG_PTR #if defined(_WIN64)//Signed long type for pointer precision. Use when casting a pointer to a long to perform pointer arithmetic.
typedef __int64 LONG_PTR;
#else
typedef long LONG_PTR;
#endif
LONG32 typedef signed int LONG32;//32-bit signed integer.
LONG64 typedef __int64 LONG64;//64-bit signed integer.
LPARAM typedef LONG_PTR LPARAM;//Message parameter.
LPBOOL typedef BOOL far *LPBOOL;//Pointer to a BOOL.
LPBYTE typedef BYTE far *LPBYTE;//Pointer to a BYTE.
LPCOLORREF typedef DWORD *LPCOLORREF;//Pointer to a COLORREF value.
LPCSTR typedef __nullterminated CONST CHAR *LPCSTR;//Pointer to a constant null-terminated string of 8-bit Windows (ANSI) characters. For more information, see Character Sets Used By Fonts.
LPCTSTR #ifdef UNICODE//An LPCWSTR if UNICODE is defined, an LPCSTR otherwise.
typedef LPCWSTR LPCTSTR;
#else
typedef LPCSTR LPCTSTR;
#endif
LPCVOID typedef CONST void *LPCVOID;//Pointer to a constant of any type.
LPCWSTR typedef CONST WCHAR *LPCWSTR;//Pointer to a constant null-terminated string of 16-bit Unicode characters. For more information, see Character Sets Used By Fonts.
LPDWORD typedef DWORD *LPDWORD;//Pointer to a DWORD.
LPHANDLE typedef HANDLE *LPHANDLE;//Pointer to a HANDLE.
LPINT typedef int *LPINT;//Pointer to an INT.
LPLONG typedef long *LPLONG;//Pointer to a LONG.
LPSTR typedef CHAR *LPSTR;//Pointer to a null-terminated string of 8-bit Windows (ANSI) characters. For more information, see Character Sets Used By Fonts.
LPTSTR #ifdef UNICODE//An LPWSTR if UNICODE is defined, an LPSTR otherwise.
typedef LPWSTR LPTSTR;
#else
typedef LPSTR LPTSTR;
#endif
LPVOID typedef void *LPVOID;//Pointer to any type.
LPWORD typedef WORD *LPWORD;//Pointer to a WORD.
LPWSTR typedef WCHAR *LPWSTR;//Pointer to a null-terminated string of 16-bit Unicode characters. For more information, see Character Sets Used By Fonts.
LRESULT typedef LONG_PTR LRESULT;//Signed result of message processing.
PBOOL typedef BOOL *PBOOL;//Pointer to a BOOL.
PBOOLEAN typedef BOOLEAN *PBOOLEAN;// Pointer to a BOOL.
PBYTE typedef BYTE *PBYTE;//Pointer to a BYTE.
PCHAR typedef CHAR *PCHAR;//Pointer to a CHAR.
PCSTR typedef CONST CHAR *PCSTR;//Pointer to a constant null-terminated string of 8-bit Windows (ANSI) characters. For more information, see Character Sets Used By Fonts.
PCTSTR #ifdef UNICODE//A PCWSTR if UNICODE is defined, a PCSTR otherwise.
typedef LPCWSTR PCTSTR;
#else
typedef LPCSTR PCTSTR;
#endif
PCWSTR typedef CONST WCHAR *PCWSTR;//Pointer to a constant null-terminated string of 16-bit Unicode characters. For more information, see Character Sets Used By Fonts.
PDWORD typedef DWORD *PDWORD;//Pointer to a DWORD.
PDWORDLONG typedef DWORDLONG *PDWORDLONG;//Pointer to a DWORDLONG.
PDWORD_PTR typedef DWORD_PTR *PDWORD_PTR;//Pointer to a DWORD_PTR.
PDWORD32 typedef DWORD32 *PDWORD32;//Pointer to a DWORD32.
PDWORD64 typedef DWORD64 *PDWORD64;//Pointer to a DWORD64.
PFLOAT typedef FLOAT *PFLOAT;//Pointer to a FLOAT.
PHALF_PTR #ifdef _WIN64//Pointer to a HALF_PTR.
typedef HALF_PTR *PHALF_PTR;
#else
typedef HALF_PTR *PHALF_PTR;
#endif
PHANDLE typedef HANDLE *PHANDLE;//Pointer to a HANDLE.
PHKEY typedef HKEY *PHKEY;//Pointer to an HKEY.
PINT typedef int *PINT;Pointer to an INT.
PINT_PTR typedef INT_PTR *PINT_PTR;//Pointer to an INT_PTR.
PINT32 typedef INT32 *PINT32;//Pointer to an INT32.
PINT64 typedef INT64 *PINT64;// Pointer to an INT64.
PLCID typedef PDWORD PLCID;//Pointer to an LCID.
PLONG typedef LONG *PLONG;//Pointer to a LONG.
PLONGLONG typedef LONGLONG *PLONGLONG;//Pointer to a LONGLONG.
PLONG_PTR typedef LONG_PTR *PLONG_PTR;//Pointer to a LONG_PTR.
PLONG32 typedef LONG32 *PLONG32;//Pointer to a LONG32.
PLONG64 typedef LONG64 *PLONG64;//Pointer to a LONG64.
POINTER_32 #if defined(_WIN64)//32-bit pointer. On a 32-bit system, this is a native pointer. On a 64-bit system, this is a truncated 64-bit pointer.
#define POINTER_32 __ptr32
#else
#define POINTER32
#endif
POINTER_64 #define POINTER_64 __ptr64//64-bit pointer. On a 64-bit system, this is a native pointer. On a 32-bit system, this is a sign-extended 32-bit pointer.
PSHORT typedef SHORT *PSHORT;//Pointer to a SHORT.
PSIZE_T typedef SIZE_T *PSIZE_T;//Pointer to a SIZE_T.
PSSIZE_T typedef SSIZE_T *PSSIZE_T;//Pointer to a SSIZE_T.
PSTR typedef CHAR *PSTR;//Pointer to a null-terminated string of 8-bit Windows (ANSI) characters. For more information, see Character Sets Used By Fonts.
PTBYTE typedef TBYTE *PTBYTE;//Pointer to a TBYTE.
PTCHAR typedef TCHAR *PTCHAR;//Pointer to a TCHAR.
PTSTR #ifdef UNICODE//A PWSTR if UNICODE is defined, a PSTR otherwise.
typedef LPWSTR PTSTR;
#else typedef LPSTR PTSTR;
#endif
PUCHAR typedef UCHAR *PUCHAR;//Pointer to a UCHAR.
PUHALF_PTR #ifdef _WIN64//Pointer to a UHALF_PTR.
typedef UHALF_PTR *PUHALF_PTR;
#else
typedef UHALF_PTR *PUHALF_PTR;
#endif
PUINT typedef UINT *PUINT;Pointer to a UINT.
PUINT_PTR typedef UINT_PTR *PUINT_PTR;//Pointer to a UINT_PTR.
PUINT32 typedef UINT32 *PUINT32;//Pointer to a UINT32.
PUINT64 typedef UINT64 *PUINT64;//Pointer to a UINT64.
PULONG typedef ULONG *PULONG;//Pointer to a ULONG.
PULONGLONG typedef ULONGLONG *PULONGLONG;//Pointer to a ULONGLONG.
PULONG_PTR typedef ULONG_PTR *PULONG_PTR;//Pointer to a ULONG_PTR.
PULONG32 typedef ULONG32 *PULONG32;//Pointer to a ULONG32.
PULONG64 typedef ULONG64 *PULONG64;// Pointer to a ULONG64.
PUSHORT typedef USHORT *PUSHORT;//Pointer to a USHORT.
PVOID typedef void *PVOID;//Pointer to any type.
PWCHAR typedef WCHAR *PWCHAR;//Pointer to a WCHAR.
PWORD typedef WORD *PWORD;//Pointer to a WORD.
PWSTR typedef WCHAR *PWSTR;//Pointer to a null- terminated string of 16-bit Unicode characters. For more information, see Character Sets Used By Fonts.
SC_HANDLE typedef HANDLE SC_HANDLE;//Handle to a service control manager database. For more information, see SCM Handles.
SC_LOCK typedef LPVOID SC_LOCK;//Lock to a service control manager database. For more information, see SCM Handles.
SERVICE_STATUS_HANDLE typedef HANDLE SERVICE_STATUS_HANDLE;//Handle to a service status value. For more information, see SCM Handles.
SHORT typedef short SHORT;//Short integer (16 bits).
SIZE_T typedef ULONG_PTR SIZE_T;//The maximum number of bytes to which a pointer can point. Use for a count that must span the full range of a pointer.
SSIZE_T typedef LONG_PTR SSIZE_T;//Signed SIZE_T.
TBYTE #ifdef UNICODE//A WCHAR if UNICODE is defined, a CHAR otherwise.
typedef WCHAR TBYTE;
#else
typedef unsigned char TBYTE;
#endif
TCHAR #ifdef UNICODE// A WCHAR if UNICODE is defined, a CHAR otherwise.
typedef WCHAR TCHAR;
#else
typedef char TCHAR;
#endif
UCHAR typedef unsigned char UCHAR;//Unsigned CHAR.
UHALF_PTR #ifdef _WIN64//Unsigned HALF_PTR. Use within a structure that contains a pointer and two small fields.
typedef unsigned int UHALF_PTR;
#else
typedef unsigned short UHALF_PTR;
#endif
UINT typedef unsigned int UINT; //Unsigned INT.
UINT_PTR #if defined(_WIN64)//Unsigned INT_PTR.
typedef unsigned __int64 UINT_PTR;
#else
typedef unsigned int UINT_PTR;
#endif
UINT32 typedef unsigned int UINT32;//Unsigned INT32.
UINT64 typedef usigned __int 64 UINT64;//Unsigned INT64.
ULONG typedef unsigned long ULONG;//Unsigned LONG.
ULONGLONG #if !defined(_M_IX86)//64-bit unsigned integer.
typedef unsigned __int64 ULONGLONG;
#else
typedef double ULONGLONG
#endif
ULONG_PTR #if defined(_WIN64)//Unsigned LONG_PTR.
typedef unsigned __int64 ULONG_PTR;
#else
typedef unsigned long ULONG_PTR;
#endif
ULONG32 typedef unsigned int ULONG32;//Unsigned LONG32.
ULONG64 typedef unsigned __int64 ULONG64;//Unsigned LONG64.
USHORT typedef unsigned short USHORT;//Unsigned SHORT.
USN typedef LONGLONG USN;//Update sequence number (USN).
VOID #define VOID void//Any type.
WCHAR typedef wchar_t WCHAR;//16-bit Unicode character. For more information, see Character Sets Used By Fonts.
WINAPI #define WINAPI __stdcall//Calling convention for system functions.
WORD typedef unsigned short WORD;//16-bit unsigned integer.
WPARAM typedef UINT_PTR WPARAM;// Message parameter.