Windows API Reference - Structures
Structures are composite data types that group related data members together. They are fundamental building blocks in Windows programming, used to pass complex information to and from API functions.
RECT Structure
The RECT structure defines the coordinates of the upper-left and lower-right corners of a rectangle.
typedef struct _RECT {
LONG left;
LONG top;
LONG right;
LONG bottom;
} RECT;
Members
| Member | Type | Description |
|---|---|---|
left |
LONG | The x-coordinate of the upper-left corner of the rectangle. |
top |
LONG | The y-coordinate of the upper-left corner of the rectangle. |
right |
LONG | The x-coordinate of the lower-right corner of the rectangle. |
bottom |
LONG | The y-coordinate of the lower-right corner of the rectangle. |
POINT Structure
The POINT structure specifies a point in two-dimensional space.
typedef struct _POINT {
LONG x;
LONG y;
} POINT;
Members
| Member | Type | Description |
|---|---|---|
x |
LONG | The x-coordinate of the point. |
y |
LONG | The y-coordinate of the point. |
SIZE Structure
The SIZE structure specifies the width and height of a rectangle or other object.
typedef struct _SIZE {
LONG cx;
LONG cy;
} SIZE;
Members
| Member | Type | Description |
|---|---|---|
cx |
LONG | The width of the rectangle. |
cy |
LONG | The height of the rectangle. |
MSG Structure
The MSG structure contains message information iterated from the message queue.
typedef struct _MSG {
HWND hwnd;
UINT message;
WPARAM wParam;
LPARAM lParam;
DWORD time;
POINT pt;
DWORD lPrivate;
} MSG;
Members
| Member | Type | Description |
|---|---|---|
hwnd |
HWND | Handle to the window that is the message destination. This parameter will be NULL if the message is sent to the calling thread, rather than to a specific window. |
message |
UINT | The type of the message. |
wParam |
WPARAM | Additional message information. The contents of this parameter depend on the value of the message parameter. |
lParam |
LPARAM | Additional message information. The contents of this parameter depend on the value of the message parameter. |
time |
DWORD | The time when the message was posted. |
pt |
POINT | The cursor position, in screen coordinates, at the time the message was posted. |
MSG structure is primarily used with the message loop for Windows applications.
WNDCLASSEX Structure
The WNDCLASSEX structure contains information about a window class.
typedef struct _WNDCLASSEX {
UINT cbSize;
UINT style;
WNDPROC lpfnWndProc;
int cbClsExtra;
int cbWndExtra;
HINSTANCE hInstance;
HICON hIcon;
HCURSOR hCursor;
HBRUSH hbrBackground;
LPCTSTR lpszMenuName;
LPCTSTR lpszClassName;
HICON hIconSm;
} WNDCLASSEX, *LPWNDCLASSEX;
Members
This structure has numerous members, each defining aspects of a window class such as its procedure, icon, cursor, and background brush. Refer to the full documentation for a complete list and description.
BITMAP Structure
The BITMAP structure contains information about a bitmap (device-dependent bitmap or DDB).
typedef struct tagBITMAP {
LONG bmType;
LONG bmWidth;
LONG bmHeight;
LONG bmWidthBytes;
WORD bmPlanes;
WORD bmBitsPixel;
LPVOID bmBits;
} BITMAP;
Members
| Member | Type | Description |
|---|---|---|
bmType |
LONG | Specifies the bitmap type. Must be zero. |
bmWidth |
LONG | Specifies the width of the bitmap, in bits. |
bmHeight |
LONG | Specifies the height of the bitmap, in bits. |
bmWidthBytes |
LONG | Specifies the width of the bitmap, in bytes. |
bmPlanes |
WORD | Specifies the number of color planes. |
bmBitsPixel |
WORD | Specifies the number of bits per pixel. |
bmBits |
LPVOID | Pointer to the bitmap bits. |
CREATEPROCESS_INFORMATION Structure
The CREATEPROCESS_INFORMATION structure contains information about a newly created process and its primary thread.
typedef struct _CREATEPROCESS_INFORMATION {
DWORD Size;
HANDLE ProcessHandle;
HANDLE ThreadHandle;
DWORD ProcessId;
DWORD ThreadId;
// ... other members omitted for brevity ...
} CREATEPROCESS_INFORMATION, *PPROCESS_INFORMATION;
CreateProcess function.
FILETIME Structure
The FILETIME structure is a 64-bit value that represents the number of 100-nanosecond intervals since January 1, 1601 (UTC).
typedef struct _FILETIME {
DWORD dwLowDateTime;
DWORD dwHighDateTime;
} FILETIME;
This structure is used to store dates and times for file operations and system timestamps.
SECURITY_ATTRIBUTES Structure
The SECURITY_ATTRIBUTES structure defines the security attributes for an object.
typedef struct _SECURITY_ATTRIBUTES {
DWORD nLength;
LPVOID lpSecurityDescriptor;
BOOL bInheritHandle;
} SECURITY_ATTRIBUTES, *PSECURITY_ATTRIBUTES, *LPSECURITY_ATTRIBUTES;
This structure is used with functions that create securable objects, such as files, pipes, and processes.
SYSTEMTIME Structure
The SYSTEMTIME structure represents a date and time, using the system's current settings for the language and locale.
typedef struct _SYSTEMTIME {
WORD wYear;
WORD wMonth;
WORD wDayOfWeek;
WORD wDay;
WORD wHour;
WORD wMinute;
WORD wSecond;
WORD wMilliseconds;
} SYSTEMTIME;
Used for retrieving or setting the system date and time.
OVERLAPPED Structure
The OVERLAPPED structure contains information used to synchronize the completion of an asynchronous operation.
typedef struct _OVERLAPPED {
DWORD Internal;
DWORD InternalHigh;
union {
struct {
DWORD Offset;
DWORD OffsetHigh;
};
PVOID Pointer;
};
HANDLE hEvent;
} OVERLAPPED, *LPOVERLAPPED;
Essential for asynchronous I/O operations in Windows.
EXCEPTION_POINTERS Structure
The EXCEPTION_POINTERS structure contains a context record and a record of the exception.
typedef struct _EXCEPTION_POINTERS {
PEXCEPTION_RECORD ExceptionRecord;
PCONTEXT ContextRecord;
} EXCEPTION_POINTERS, *PEXCEPTION_POINTERS;
Used in exception handling mechanisms, particularly for structured exception handling (SEH).