Comprehensive documentation for the Windows API
The Win32 API (Application Programming Interface) is the primary API for Microsoft Windows. It provides a rich set of functions that allow applications to interact with the Windows operating system. This includes functionalities for window management, graphics, memory management, inter-process communication, and much more.
The Win32 API is a comprehensive collection of C-based functions, data types, and structures that form the foundation for developing applications on Windows. It exposes core operating system features, enabling developers to build sophisticated and native applications.
GetLastError()
for retrieving detailed error information.Explore some of the most frequently accessed areas of the Win32 API:
Functions for creating, managing, and interacting with windows, dialog boxes, and controls.
CreateWindowEx
: Creates an extended window.ShowWindow
: Sets the show state of a top-level window.MessageBox
: Displays a message box.GetMessage
: Retrieves messages from the calling thread's message queue.PeekMessage
: Checks for messages in the thread's message queue.CreateWindowEx
Description: Creates an overlapping, pop-up, or child window with extended window styles.
Syntax: HWND CreateWindowEx(DWORD dwExStyle, LPCTSTR lpClassName, LPCTSTR lpWindowName, DWORD dwStyle, int x, int y, int nWidth, int nHeight, HWND hWndParent, HMENU hMenu, HINSTANCE hInstance, LPVOID lpParam);
Parameters: A comprehensive set of parameters defining the window's appearance, behavior, and owner.
Return Value: If the function succeeds, the return value is the handle to the new window. Otherwise, it is NULL
.
ShowWindow
Description: Sets the show state of a top-level window.
Syntax: BOOL ShowWindow(HWND hWnd, int nCmdShow);
Parameters: hWnd
- Handle to the window. nCmdShow
- Controls how the window is to be shown.
Return Value: If the window was previously visible, the return value is nonzero. Otherwise, the return value is zero.
MessageBox
Description: Creates, displays, and operates a message box, which is a dialog box that presents a message to the user and waits for the user to acknowledge the message.
Syntax: int MessageBox(HWND hWnd, LPCTSTR lpText, LPCTSTR lpCaption, UINT uType);
Parameters: hWnd
- Handle to the owner window. lpText
- The message to be displayed. lpCaption
- The title of the message box. uType
- The buttons and icons to be displayed.
Return Value: An integer value indicating which of the predefined buttons was chosen by the user.
Functions for drawing lines, shapes, text, and bitmaps.
CreatePen
: Creates a GDI pen.Rectangle
: Draws a rectangle.TextOut
: Writes a string of characters at the specified location.CreatePen
Description: Creates a new graphic pen with the specified style, width, and color.
Syntax: HPEN CreatePen(int fnPenStyle, int nWidth, COLORREF crColor);
Parameters: fnPenStyle
- The style of the pen. nWidth
- The width of the pen. crColor
- The color of the pen.
Return Value: If the function succeeds, the return value is a handle to the newly created pen object. Otherwise, it is NULL
.
Functions for allocating, deallocating, and manipulating memory.
GlobalAlloc
: Allocates a fixed or movable memory object.LocalAlloc
: Allocates memory from a local heap.HeapAlloc
: Allocates a block of memory from a specified heap.Functions for creating, reading, writing, and managing files.
CreateFile
: Creates or opens a file.ReadFile
: Reads data from a file.WriteFile
: Writes data to a file.CloseHandle
: Closes an open object handle.Functions for creating and managing processes and threads.
CreateProcess
: Creates a new process and its primary thread.ExitProcess
: Terminates the calling process.CreateThread
: Creates a thread to execute within the virtual address space of the calling process.Functions for accessing and manipulating the Windows Registry.
RegOpenKeyEx
: Opens an existing registry key.RegQueryValueEx
: Retrieves the type and data for a specified registry value.RegSetValueEx
: Sets the data and attribute of a specified registry value.