Skip to content
Surf Wiki
Save to docs
technology/operating-systems

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

NameDescription
character classification
variable-argument function support
string and buffer manipulation

Basic

NameDescription
title=Windows Data Typesurl=https://learn.microsoft.com/en-us/windows/win32/winprog/windows-data-typespublisher=learn.microsoft.comdate=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

NameDescription
`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

NameDescription
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 datatype TCHAR to 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 _UNICODE macro.
  • RC_INVOKED defined when the resource compiler () is in use instead of a C compiler.
  • WINVER used to enable features only available in newer operating systems. Define it to 0x0501 for Windows XP, and 0x0600 for Windows Vista.
  • WIN32_LEAN_AND_MEAN used 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

  1. (7 November 2024). "Windows Data Types". learn.microsoft.com.
  2. (23 January 2023). "guiddef.h header". learn.microsoft.com.
  3. (23 January 2023). "winerror.h header". learn.microsoft.com.
  4. (23 January 2023). "wingdi.h header". learn.microsoft.com.
  5. (23 January 2023). "winnetwk.h header". learn.microsoft.com.
  6. (23 January 2023). "winnt.h header". learn.microsoft.com.
  7. (23 January 2023). "winreg.h header". learn.microsoft.com.
  8. (19 November 2024). "MAKEINTRESOURCEA macro (winuser.h)". learn.microsoft.com.
  9. (22 February 2024). "DialogBoxA macro (winuser.h)". learn.microsoft.com.
  10. (23 January 2023). "winuser.h header". learn.microsoft.com.
  11. (23 January 2023). "winver.h header". learn.microsoft.com.
  12. (21 January 2021). "Making Win32 APIs More Accessible to More Languages". blogs.windows.com.
  13. "win32metadata".
Info: Wikipedia Source

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.

Want to explore this topic further?

Ask Mako anything about Windows.h — get instant answers, deeper analysis, and related topics.

Research with Mako

Free with your Surf account

Content sourced from Wikipedia, available under CC BY-SA 4.0.

This 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