From Surf Wiki (app.surf) — the open knowledge base
Windows.h
Defines access to the Windows API in C language syntax
Defines access to the Windows API in C language syntax
**** is a source code header file that Microsoft provides for the development of programs that access the Windows API (WinAPI) via C language. It declares the WinAPI functions, associated data types and common macros.
Access to WinAPI can be enabled for a C or C++ program by including it into a source file:
// in C:
#include <Windows.h>
// in C++:
import <Windows.h>;
Also, the executable must be linked to each static library that either contains the function code or more commonly defines runtime, dynamic linking to a system dynamic link library (DLL). Generally, for functions in a DLL named like , the program must be linked to a library named like . For MinGW, the library name is like .
Included header files
Including results in including various other header files that are included directly or indirectly by . Many of these header files cannot be included on their own due to dependencies between the various header files.
Notable included header files:
Standard C
| Name | Description |
|---|---|
| character classification | |
| variable-argument function support | |
| string and buffer manipulation |
Basic
| Name | Description | |||
|---|---|---|---|---|
| title=Windows Data Types | url=https://learn.microsoft.com/en-us/windows/win32/winprog/windows-data-types | publisher=learn.microsoft.com | date=7 November 2024}} | |
| the [](guid) | ||||
| Input Method Editor (IME) | ||||
| kernel32.dll: kernel services; advapi32.dll: kernel services (e.g. `CreateProcessAsUser()` function), access control (e.g. `AdjustTokenGroups()` function). | ||||
| console services | ||||
| various macros and types | ||||
| error codes | ||||
| Graphics Device Interface (GDI) | ||||
| Windows Networking (WNet) | ||||
| Native Language Support (NLS) | ||||
| various macros and types (for Windows NT) | ||||
| Windows registry | ||||
| Windows services and the Service Control Manager (SCM) | ||||
| Calls on for user services, inline resource macro (e.g. `MAKEINTRESOURCE` macro), inline dialog macro(e.g. DialogBox function). | ||||
| version information |
Extra
| Name | Description |
|---|---|
| `CommDlgExtendedError` function error codes | |
| Common Dialog Boxes | |
| DDE (Dynamic Data Exchange) | |
| DDE Management Library | |
| various constants for Common Dialog Boxes | |
| LZ (Lempel-Ziv) compression/decompression | |
| Windows Multimedia | |
| NetBIOS | |
| RPC (Remote procedure call) | |
| Windows Shell API | |
| Cryptographic API | |
| Performance monitoring | |
| used in resources | |
| Winsock (Windows Sockets), version 1.1 | |
| Print Spooler | |
| Standard graphics library |
OLE and COM
| Name | Description |
|---|---|
| OLE (Object Linking and Embedding) | |
| COM (Component Object Model) | |
| OLE Automation | |
| various GUID definitions |
Macros
Several macros affect the definitions made by and the files it includes.
UNICODE; when defined, this causes the generic text datatypeTCHARto be a synonym of instead of , and all type-generic API functions and messages that work with text will be defined to the -W versions instead of the -A versions. It is similar to the windows C runtime's_UNICODEmacro.RC_INVOKEDdefined when the resource compiler () is in use instead of a C compiler.WINVERused to enable features only available in newer operating systems. Define it to0x0501for Windows XP, and0x0600for Windows Vista.WIN32_LEAN_AND_MEANused to reduce the size of the header files and speed up compilation. Excludes things like cryptography, DDE, RPC, the Windows Shell and Winsock.
Other languages
Microsoft has plans to update the Windows API for modern C++ usage with their win32metadata project. Microsoft has also created bindings for other languages, including C# and Rust for calling the Win32 API.
References
References
- (7 November 2024). "Windows Data Types". learn.microsoft.com.
- (23 January 2023). "guiddef.h header". learn.microsoft.com.
- (23 January 2023). "winerror.h header". learn.microsoft.com.
- (23 January 2023). "wingdi.h header". learn.microsoft.com.
- (23 January 2023). "winnetwk.h header". learn.microsoft.com.
- (23 January 2023). "winnt.h header". learn.microsoft.com.
- (23 January 2023). "winreg.h header". learn.microsoft.com.
- (19 November 2024). "MAKEINTRESOURCEA macro (winuser.h)". learn.microsoft.com.
- (22 February 2024). "DialogBoxA macro (winuser.h)". learn.microsoft.com.
- (23 January 2023). "winuser.h header". learn.microsoft.com.
- (23 January 2023). "winver.h header". learn.microsoft.com.
- (21 January 2021). "Making Win32 APIs More Accessible to More Languages". blogs.windows.com.
- "win32metadata".
This article was imported from Wikipedia and is available under the Creative Commons Attribution-ShareAlike 4.0 License. Content has been adapted to SurfDoc format. Original contributors can be found on the article history page.
Ask Mako anything about Windows.h — get instant answers, deeper analysis, and related topics.
Research with MakoFree with your Surf account
Create a free account to save articles, ask Mako questions, and organize your research.
Sign up freeThis content may have been generated or modified by AI. CloudSurf Software LLC is not responsible for the accuracy, completeness, or reliability of AI-generated content. Always verify important information from primary sources.
Report