In this article

Windows Data Types

05/31/2018

19 minutes to read

In this article

The data types supported by Windows are used to define function return values, function and message parameters, and structure members. They define the size and meaning of these elements. For more information about the underlying C/C++ data types, see Data Type Ranges.

The following table contains the following types: character, integer, Boolean, pointer, and handle. The character, integer, and Boolean types are common to most C compilers. Most of the pointer-type names begin with a prefix of P or LP. Handles refer to a resource that has been loaded into memory.

For more information about handling 64-bit integers, see Large Integers.

Data type

Description

APIENTRY

The calling convention for system functions. This type is declared in WinDef.h as follows:#define APIENTRY WINAPI

ATOM

An atom. For more information, see About Atom Tables. This type is declared in WinDef.h as follows:typedef WORD ATOM;

BOOL

A Boolean variable (should be TRUE or FALSE). This type is declared in WinDef.h as follows:typedef int BOOL;

BOOLEAN

A Boolean variable (should be TRUE or FALSE). This type is declared in WinNT.h as follows:typedef BYTE BOOLEAN;

BYTE

A byte (8 bits). This type is declared in WinDef.h as follows:typedef unsigned char BYTE;

CALLBACK

The calling convention for callback functions. This type is declared in WinDef.h as follows:#define CALLBACK __stdcallCALLBACK, WINAPI, and APIENTRY are all used to define functions with the __stdcall calling convention. Most functions in the Windows API are declared using WINAPI. You may wish to use CALLBACK for the callback functions that you implement to help identify the function as a callback function.

CCHAR

An 8-bit Windows (ANSI) character. This type is declared in WinNT.h as follows:typedef char CCHAR;

CHAR

An 8-bit Windows (ANSI) character. For more information, see Character Sets Used By Fonts. This type is declared in WinNT.h as follows:typedef char CHAR;

COLORREF

The red, green, blue (RGB) color value (32 bits). See COLORREF for information on this type. This type is declared in WinDef.h as follows:typedef DWORD COLORREF;

CONST

A variable whose value is to remain constant during execution. This type is declared in WinDef.h as follows:#define CONST const

DWORD

A 32-bit unsigned integer. The range is 0 through 4294967295 decimal. This type is declared in IntSafe.h as follows:typedef unsigned long DWORD;

DWORDLONG

A 64-bit unsigned integer. The range is 0 through 18446744073709551615 decimal. This type is declared in IntSafe.h as follows:typedef unsigned __int64 DWORDLONG;

DWORD_PTR

An 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.) This type is declared in BaseTsd.h as follows:typedef ULONG_PTR DWORD_PTR;

DWORD32

A 32-bit unsigned integer. This type is declared in BaseTsd.h as follows:typedef unsigned int DWORD32;

DWORD64

A 64-bit unsigned integer. This type is declared in BaseTsd.h as follows:typedef unsigned __int64 DWORD64;

FLOAT

A floating-point variable. This type is declared in WinDef.h as follows:typedef float FLOAT;

HACCEL

A handle to an accelerator table. This type is declared in WinDef.h as follows:typedef HANDLE HACCEL;

HALF_PTR

Half the size of a pointer. Use within a structure that contains a pointer and two small fields. This type is declared in BaseTsd.h as follows:

CALLBACK, WINAPI, and APIENTRY are all used to define functions with the __stdcall calling convention. Most functions in the Windows API are declared using WINAPI. You may wish to use CALLBACK for the callback functions that you implement to help identify the function as a callback function.