The Windows API, informally WinAPI, is Microsoft's core set of
application programming interfaces (APIs) available in the
Microsoft Windows operating systems. The name Windows API collectively refers to several different platform implementations that are often referred to by their own names (for example, Win32 API); see the
versions
Version may refer to:
Computing
* Software version, a set of numbers that identify a unique evolution of a computer program
* VERSION (CONFIG.SYS directive), a configuration directive in FreeDOS
Music
* Cover version
* Dub version
* Remix
* ''Ve ...
section. Almost all Windows programs interact with the Windows API. On the Windows NT line of operating systems, a small number (such as programs started early in the
Windows startup process) use the
Native API
The Native API is a lightweight application programming interface (API) used by Windows NT and user mode applications. This API is used in the early stages of Windows NT startup process, when other components and APIs are still unavailable. There ...
.
Developer support is available in the form of a
software development kit
A software development kit (SDK) is a collection of software development tools in one installable package. They facilitate the creation of applications by having a compiler, debugger and sometimes a software framework. They are normally specific ...
,
Microsoft Windows SDK
Microsoft Windows SDK, and its predecessors Platform SDK, and .NET Framework SDK, are software development kits (SDKs) from Microsoft that contain documentation, header files, libraries, samples and tools required to develop applications for Micr ...
, providing documentation and tools needed to build software based on the Windows API and associated Windows interfaces.
The Windows API (Win32) is focused mainly on the programming language
C in that its exposed functions and data structures are described in that language in recent versions of its documentation. However, the API may be used by any programming language
compiler
In computing, a compiler is a computer program that translates computer code written in one programming language (the ''source'' language) into another language (the ''target'' language). The name "compiler" is primarily used for programs that ...
or
assembler able to handle the (well-defined) low-level data structures along with the prescribed
calling convention
In computer science, a calling convention is an implementation-level (low-level) scheme for how subroutines or functions receive parameters from their caller and how they return a result. When some code calls a function, design choices have b ...
s for calls and
callbacks
In computer programming, a callback or callback function is any reference to executable code that is passed as an argument to another piece of code; that code is expected to ''call back'' (execute) the callback function as part of its job. Thi ...
. Similarly, the internal implementation of the API's function has been developed in several languages, historically. Despite the fact that C is not an
object-oriented programming
Object-oriented programming (OOP) is a programming paradigm based on the concept of " objects", which can contain data and code. The data is in the form of fields (often known as attributes or ''properties''), and the code is in the form of ...
language, the Windows API and Windows have both historically been described as object-oriented. There have also been many wrapper classes and extensions (from Microsoft and others) for object-oriented languages that make this object-oriented structure more explicit (
Microsoft Foundation Class Library (MFC),
Visual Component Library
The Visual Component Library (VCL) is a visual component-based object-oriented framework for developing the user interface of Microsoft Windows applications. It is written in Object Pascal.
History
The VCL was developed by Borland for u ...
(VCL),
GDI+, etc.). For instance,
Windows 8
Windows 8 is a major release of the Windows NT operating system developed by Microsoft. It was released to manufacturing on August 1, 2012; it was subsequently made available for download via MSDN and TechNet on August 15, 2012, and later to ...
provides the Windows API and the
WinRT API, which is implemented in
C++ and is object-oriented by design.
Overview
The functions provided by the Windows API can be grouped into eight categories:
Microsoft Developer Network
Microsoft Developer Network (MSDN) was the division of Microsoft responsible for managing the firm's relationship with developers and testers, such as hardware developers interested in the operating system (OS), and software developers developing ...
(July 2005).
Overview of the Windows API.
' Retrieved August 28, 2005.
; Base Services:
Microsoft Developer Network
Microsoft Developer Network (MSDN) was the division of Microsoft responsible for managing the firm's relationship with developers and testers, such as hardware developers interested in the operating system (OS), and software developers developing ...
(July 2005).
Base Services.
' Retrieved August 28, 2005. Provide access to the basic resources available to a Windows system. Included are things like
file system
In computing, file system or filesystem (often abbreviated to fs) is a method and data structure that the operating system uses to control how data is stored and retrieved. Without a file system, data placed in a storage medium would be one lar ...
s,
devices,
processes
A process is a series or set of activities that interact to produce a result; it may occur once-only or be recurrent or periodic.
Things called a process include:
Business and management
*Business process, activities that produce a specific se ...
,
threads
Thread may refer to:
Objects
* Thread (yarn), a kind of thin yarn used for sewing
** Thread (unit of measurement), a cotton yarn measure
* Screw thread, a helical ridge on a cylindrical fastener
Arts and entertainment
* ''Thread'' (film), 2016 ...
, and
error handling. These functions reside in
kernel.exe,
krnl286.exe or
krnl386.exe files on 16-bit Windows, and
kernel32.dll and KernelBase.dll on 32 and 64 bit Windows. These files reside in the folder
\Windows\System32 on all versions of Windows.
; Advanced Services
:Provide access to functions beyond the kernel. Included are things like the
Windows registry
The Windows Registry is a hierarchical database that stores low-level settings for the Microsoft Windows operating system and for applications that opt to use the registry. The kernel, device drivers, services, Security Accounts Manager, and u ...
, shutdown/restart the system (or abort), start/stop/create a
Windows service, manage user accounts. These functions reside in
advapi32.dll and
advapires32.dll on 32-bit Windows.
;
Graphics Device Interface
The Graphics Device Interface (GDI) is a legacy component of Microsoft Windows responsible for representing graphical objects and transmitting them to output devices such as monitors and printers. Windows apps use Windows API to interact with ...
:
Microsoft Developer Network
Microsoft Developer Network (MSDN) was the division of Microsoft responsible for managing the firm's relationship with developers and testers, such as hardware developers interested in the operating system (OS), and software developers developing ...
(July 2005).
Graphics Device Interface.
' Retrieved August 28, 2005. Provides functions to output graphics content to
monitors,
printers, and other
output devices. It resides in
gdi.exe on 16-bit Windows, and
gdi32.dll on 32-bit Windows in user-mode. Kernel-mode GDI support is provided by
win32k.sys
which communicates directly with the graphics driver.
;
User Interface
In the industrial design field of human–computer interaction, a user interface (UI) is the space where interactions between humans and machines occur. The goal of this interaction is to allow effective operation and control of the machine f ...
:
Microsoft Developer Network
Microsoft Developer Network (MSDN) was the division of Microsoft responsible for managing the firm's relationship with developers and testers, such as hardware developers interested in the operating system (OS), and software developers developing ...
(July 2005).
User Interface.
' Retrieved August 28, 2005. Provides the functions to create and manage screen
windows
Windows is a group of several proprietary graphical operating system families developed and marketed by Microsoft. Each family caters to a certain sector of the computing industry. For example, Windows NT for consumers, Windows Server for ...
and most basic controls, such as
buttons and
scrollbar
A scrollbar is an interaction technique or widget in which continuous text, pictures, or any other content can be scrolled in a predetermined direction (up, down, left, or right) on a computer display, window, or viewport so that all of the ...
s, receive mouse and keyboard input, and other functions associated with the
graphical user interface
The GUI ( "UI" by itself is still usually pronounced . or ), graphical user interface, is a form of user interface that allows User (computing), users to Human–computer interaction, interact with electronic devices through graphical icon (comp ...
(GUI) part of Windows. This functional unit resides in
user.exe on 16-bit Windows, and
user32.dll on 32-bit Windows. Since
Windows XP
Windows XP is a major release of Microsoft's Windows NT operating system. It was release to manufacturing, released to manufacturing on August 24, 2001, and later to retail on October 25, 2001. It is a direct upgrade to its predecessors, Wind ...
versions, the basic controls reside in
comctl32.dll, together with the common controls (Common Control Library).
; Common Dialog Box Library:
Microsoft Developer Network
Microsoft Developer Network (MSDN) was the division of Microsoft responsible for managing the firm's relationship with developers and testers, such as hardware developers interested in the operating system (OS), and software developers developing ...
(2005).
Common Dialog Box Library.
' Retrieved September 22, 2005. Provides applications the standard
dialog box
The dialog box (also called dialogue box (non-U.S. English), message box or simply dialog) is a graphical control element in the form of a small window that communicates information to the user and prompts them for a response.
Dialog boxes ar ...
es to open and save files, choose color and font, etc. The library resides in a file called
commdlg.dll on 16-bit Windows, and
comdlg32.dll on 32-bit Windows. It is grouped under the ''User Interface'' category of the API.
; Common Control Library:
Microsoft Developer Network
Microsoft Developer Network (MSDN) was the division of Microsoft responsible for managing the firm's relationship with developers and testers, such as hardware developers interested in the operating system (OS), and software developers developing ...
(July 2005).
Common Control Library.
' Retrieved August 28, 2005. Gives applications access to some advanced controls provided by the operating system. These include things like
status bar
A status bar is a graphical control element which poses an information area typically found at the window's bottom.
It can be divided into sections to group information. Its job is primarily to display information about the current state of its ...
s,
progress bars,
toolbar
The toolbar, also called a bar or standard toolbar (originally known as ribbon) is a graphical control element on which on-screen icons can be used. A toolbar often allows for quick access to functions that are commonly used in the program. Some ...
s and
tabs. The library resides in a
dynamic-link library
Dynamic-link library (DLL) is Microsoft's implementation of the shared library concept in the Microsoft Windows and OS/2 operating systems. These libraries usually have the file extension DLL, OCX (for libraries containing ActiveX controls) ...
(DLL) file called
commctrl.dll on 16-bit Windows, and
comctl32.dll on 32-bit Windows. It is grouped under the ''User Interface'' category of the API.
; Windows Shell:
Microsoft Developer Network
Microsoft Developer Network (MSDN) was the division of Microsoft responsible for managing the firm's relationship with developers and testers, such as hardware developers interested in the operating system (OS), and software developers developing ...
(July 2005).
Windows Shell.
' Retrieved August 28, 2005.Microsoft Developer Network
Microsoft Developer Network (MSDN) was the division of Microsoft responsible for managing the firm's relationship with developers and testers, such as hardware developers interested in the operating system (OS), and software developers developing ...
(2005).
Shell Programmer's Guide.
' Retrieved August 28, 2005. Component of the Windows API allows applications to access functions provided by the
operating system shell
In computing, a shell is a computer program that exposes an operating system's services to a human user or other programs. In general, operating system shells use either a command-line interface (CLI) or graphical user interface (GUI), dependin ...
, and to change and enhance it. The component resides in
shell.dll on 16-bit Windows, and
shell32.dll on 32-bit Windows. The Shell Lightweight Utility Functions are in
shlwapi.dll. It is grouped under the ''User Interface'' category of the API.
; Network Services:
Microsoft Developer Network
Microsoft Developer Network (MSDN) was the division of Microsoft responsible for managing the firm's relationship with developers and testers, such as hardware developers interested in the operating system (OS), and software developers developing ...
(July 2005).
Network Services.
' Retrieved August 28, 2005. Give access to the various
networking
Network, networking and networked may refer to:
Science and technology
* Network theory, the study of graphs as a representation of relations between discrete objects
* Network science, an academic field that studies complex networks
Mathematics
...
abilities of the operating system. Its subcomponents include
NetBIOS,
Winsock,
NetDDE,
remote procedure call
In distributed computing, a remote procedure call (RPC) is when a computer program causes a procedure (subroutine) to execute in a different address space (commonly on another computer on a shared network), which is coded as if it were a normal (lo ...
(RPC) and many more. This component resides in
netapi32.dll on 32-bit Windows.
Web
The
Internet Explorer
Internet Explorer (formerly Microsoft Internet Explorer and Windows Internet Explorer, commonly abbreviated IE or MSIE) is a series of graphical user interface, graphical web browsers developed by Microsoft which was used in the Microsoft Wind ...
(IE) web browser also exposes many APIs that are often used by applications, and as such could be considered a part of the Windows API. IE has been included with the operating system since
Windows 95 OSR2 and has provided web-related services to applications since
Windows 98
Windows 98 is a consumer-oriented operating system developed by Microsoft as part of its Windows 9x family of Microsoft Windows operating systems. The second operating system in the 9x line, it is the successor to Windows 95, and was released ...
.
Microsoft Developer Network
Microsoft Developer Network (MSDN) was the division of Microsoft responsible for managing the firm's relationship with developers and testers, such as hardware developers interested in the operating system (OS), and software developers developing ...
(January 2006);
Programming and reusing the browser
' Retrieved January 22, 2006. Specifically, it is used to provide:
* An embeddable web browser control, contained in
shdocvw.dll and
mshtml.dll.
* The URL moniker service, held in
urlmon.dll, which provides
COM objects to applications for resolving URLs. Applications can also provide their own URL handlers for others to use.
* An HTTP client library which also takes into account system-wide Proxy settings (wininet.dll); however, Microsoft has added another HTTP client library called winhttp.dll which is smaller and more suitable for some applications.
* A library to assist multi-language and international text support (mlang.dll).
* DirectX Transforms, a set of image filter components.
* XML support (the MSXML components, held in
msxml*.dll).
* Access to the Windows Address Books.
Multimedia
The classic Windows Multimedia API is placed in winmm.dll and contains functions to play sound files, to send and receive MIDI messages, to access joysticks, and to facilitate all other features of the so-called ''MCI'' subsystem of Windows, which originates from the ''Multimedia Extensions'' available for Windows 3.0 separately and as an integral part of the operating system since Windows 3.1, at which time they were located in mmsystem.dll.
Apart from that, as part of every Windows version since
Windows 95
Windows 95 is a consumer-oriented operating system developed by Microsoft as part of its Windows 9x family of operating systems. The first operating system in the 9x family, it is the successor to Windows 3.1x, and was released to manufactu ...
OSR2, Microsoft has provided the
DirectX
Microsoft DirectX is a collection of application programming interfaces (APIs) for handling tasks related to multimedia, especially game programming and video, on Microsoft platforms. Originally, the names of these APIs all began with "Direc ...
APIs—a loosely related set of graphics and gaming services, which includes:
*
Direct2D
Direct2D is a 2D vector graphics application programming interface (API) designed by Microsoft and implemented in Windows 10, Windows 8, Windows 7 and Windows Server 2008 R2, and also Windows Vista and Windows Server 2008 (with Platform Update in ...
for hardware-accelerated 2D vector graphics.
*
Direct3D
Direct3D is a graphics application programming interface (API) for Microsoft Windows. Part of DirectX, Direct3D is used to render three-dimensional graphics in applications where performance is important, such as games. Direct3D uses hardware ...
for hardware-accelerated 3D graphics.
*
DirectSound
DirectSound is a deprecated software component of the Microsoft DirectX library for the Windows operating system, superseded by XAudio2. It provides a low-latency interface to sound card drivers written for Windows 95 through Windows XP and c ...
for low-level hardware-accelerated sound card access.
*
DirectInput for communication with input devices such as joysticks and gamepads.
*
DirectPlay as a multiplayer gaming infrastructure. This component has been deprecated as of DirectX 9, and Microsoft no longer recommends its use for game development.
*
DirectDraw for 2D graphics in earlier DirectX versions, now deprecated and replaced with Direct2D.
*
WinG
A wing is a type of fin that produces lift while moving through air or some other fluid. Accordingly, wings have streamlined cross-sections that are subject to aerodynamic forces and act as airfoils. A wing's aerodynamic efficiency is exp ...
for 2D graphics in 16-bit games written for Windows 3.x versions. Deprecated with Windows 95 release.
Microsoft also provides several APIs for media encoding and playback:
*
DirectShow
DirectShow (sometimes abbreviated as DS or DShow), codename Quartz, is a multimedia framework and API produced by Microsoft for software developers to perform various operations with media files or streams. It is the replacement for Microsoft's e ...
, which builds and runs generic multimedia pipelines. It is comparable to the
GStreamer
GStreamer is a pipeline-based multimedia framework that links together a wide variety of media processing systems to complete complex workflows. For instance, GStreamer can be used to build a system that reads files in one format, processes the ...
framework and often used to render in-game videos and build media players (
Windows Media Player
Windows Media Player (WMP) is the first media player and media library application that was developed by Microsoft for playing audio, video and viewing images on personal computers running the Microsoft Windows operating system, as well as ...
is based on it). DirectShow is no longer recommended for game development.
*
Media Foundation
Media Foundation (MF) is a COM-based multimedia framework pipeline and infrastructure platform for digital media in Windows Vista, Windows 7, Windows 8, Windows 8.1, Windows 10, and Windows 11. It is the intended replacement for Microsoft Direc ...
, a newer digital media API intended to replace DirectShow.
Program interaction
The Windows API is designed mostly for the interaction between the
operating system
An operating system (OS) is system software that manages computer hardware, software resources, and provides common daemon (computing), services for computer programs.
Time-sharing operating systems scheduler (computing), schedule tasks for ef ...
and an application. For communication among different Windows applications, Microsoft has developed a series of technologies alongside the main Windows API. This started out with
Dynamic Data Exchange (DDE), which was superseded by
Object Linking and Embedding
Object Linking & Embedding (OLE) is a proprietary technology developed by Microsoft that allows embedding and linking to documents and other objects. For developers, it brought OLE Control Extension (OCX), a way to develop and use custom user ...
(OLE) and later by the
Component Object Model (COM),
Automation Objects,
ActiveX
ActiveX is a deprecated software framework created by Microsoft that adapts its earlier Component Object Model (COM) and Object Linking and Embedding (OLE) technologies for content downloaded from a network, particularly from the World Wide Web. ...
controls, and the
.NET Framework
The .NET Framework (pronounced as "''dot net"'') is a proprietary software framework developed by Microsoft that runs primarily on Microsoft Windows. It was the predominant implementation of the Common Language Infrastructure (CLI) until bein ...
. There is not always a clear distinction between these technologies, and there is much overlap.
The variety of terms is basically the result of grouping software mechanisms that relate to a given aspect of software development. Automation specifically relates to exporting the function of an application or component (as an
application programming interface (API)) so that it can be controlled by other applications instead of by human users only, .NET is a self-contained general methodology and technology to develop desktop and web applications written in a variety of
just-in-time (JIT) compiled languages.
Windows.pas is a
Pascal/
Delphi
Delphi (; ), in legend previously called Pytho (Πυθώ), in ancient times was a sacred precinct that served as the seat of Pythia, the major oracle who was consulted about important decisions throughout the ancient classical world. The oracl ...
unit which contains the
Windows
Windows is a group of several proprietary graphical operating system families developed and marketed by Microsoft. Each family caters to a certain sector of the computing industry. For example, Windows NT for consumers, Windows Server for ...
-specific API declarations. It is the Pascal equivalent to
windows.h, used in C.
Wrapper libraries
Various
wrappers were developed by Microsoft that took over some of the more low level functions of the Windows API, and allowed applications to interact with the API in a more abstract manner.
Microsoft Foundation Class Library (MFC) wrapped Windows API functionality in
C++ classes, and thus allows a more
object-oriented
Object-oriented programming (OOP) is a programming paradigm based on the concept of " objects", which can contain data and code. The data is in the form of fields (often known as attributes or ''properties''), and the code is in the form of ...
way to interact with the API. The
Active Template Library (ATL) is a
template
Template may refer to:
Tools
* Die (manufacturing), used to cut or shape material
* Mold, in a molding process
* Stencil, a pattern or overlay used in graphic arts (drawing, painting, etc.) and sewing to replicate letters, shapes or designs
Co ...
oriented wrapper for COM. The
Windows Template Library (WTL) was developed as an extension to ATL, and intended as a smaller alternative to MFC.
Most
application frameworks for Windows (at least partly) wrap the Windows API. Thus, the
.NET Framework
The .NET Framework (pronounced as "''dot net"'') is a proprietary software framework developed by Microsoft that runs primarily on Microsoft Windows. It was the predominant implementation of the Common Language Infrastructure (CLI) until bein ...
and
Java
Java (; id, Jawa, ; jv, ꦗꦮ; su, ) is one of the Greater Sunda Islands in Indonesia. It is bordered by the Indian Ocean to the south and the Java Sea to the north. With a population of 151.6 million people, Java is the world's mo ...
, likewise any other
programming language
A programming language is a system of notation for writing computer programs. Most programming languages are text-based formal languages, but they may also be graphical. They are a kind of computer language.
The description of a programming l ...
s under Windows, are (or contain) wrapper libraries.
History
The Windows API has always exposed a large part of the underlying structure of the Windows systems to programmers. This had the advantage of giving them much flexibility and power over their applications, but also creates great responsibility in how applications handle various low-level, sometimes tedious, operations that are associated with a
graphical user interface
The GUI ( "UI" by itself is still usually pronounced . or ), graphical user interface, is a form of user interface that allows User (computing), users to Human–computer interaction, interact with electronic devices through graphical icon (comp ...
.
For example, a beginning C programmer will often write the simple "hello world" as their first assignment. The working part of the program is only a single printf line within the main subroutine. The overhead for linking to the standard I/O library is also only one line:
#include
int main(void)
The Windows version was still only one working line of code but it required many, many more lines of overhead.
Charles Petzold
Charles Petzold (born February 2, 1953) is an American programmer and technical author on Microsoft Windows applications. He is also a Microsoft Most Valuable Professional and was named one of Microsoft's seven Windows Pioneers.
Biography
He g ...
, who wrote several books about programming for the Windows API, said: "The original
hello world program
''Hello'' is a salutation or greeting in the English language. It is first attested in writing from 1826. Early uses
''Hello'', with that spelling, was used in publications in the U.S. as early as the 18 October 1826 edition of the '' Norwich ...
in the Windows 1.0 SDK was a bit of a scandal. HELLO.C was about 150 lines long, and the HELLO.RC resource script had another 20 or so more lines. (...) Veteran programmers often curled up in horror or laughter when encountering the Windows hello-world program."
Charles Petzold
Charles Petzold (born February 2, 1953) is an American programmer and technical author on Microsoft Windows applications. He is also a Microsoft Most Valuable Professional and was named one of Microsoft's seven Windows Pioneers.
Biography
He g ...
(December 2001). ''Programming Microsoft Windows with C#''. Microsoft Press. Beyond the Console, page 47.
Over the years, various changes and additions were made to Windows systems, and the Windows API changed and grew to reflect this.
Detailed analysis of changes in the Windows API from XP to 10.
' Retrieved September 08, 2016. The Windows API for
Windows 1.0 supported fewer than 450
function calls, whereas modern versions of the Windows API support thousands. However, in general, the interface remained fairly consistent, and an old Windows 1.0 application will still look familiar to a programmer who is used to the modern Windows API.
Charles Petzold
Charles Petzold (born February 2, 1953) is an American programmer and technical author on Microsoft Windows applications. He is also a Microsoft Most Valuable Professional and was named one of Microsoft's seven Windows Pioneers.
Biography
He g ...
(November 11, 1998). ''Programming Windows, Fifth Edition''. Microsoft Press. APIs and Memory Models, page 9.
Microsoft has made an effort to maintain
backward compatibility
Backward compatibility (sometimes known as backwards compatibility) is a property of an operating system, product, or technology that allows for interoperability with an older legacy system, or with input designed for such a system, especially ...
. To achieve this, when developing new versions of Windows, Microsoft sometimes implemented workarounds to allow compatibility with third-party software that used the prior version in an undocumented or even inadvisable way.
Raymond Chen, a Microsoft developer who works on the Windows API, has said: "I could probably write for months solely about bad things apps do and what we had to do to get them to work again (often in spite of themselves). Which is why I get particularly furious when people accuse Microsoft of maliciously breaking applications during OS upgrades. If any application failed to run on Windows 95, I took it as a personal failure."
[ Raymond Chen (October 15, 2003). ]
What about BOZOSLIVEHERE and TABTHETEXTOUTFORWIMPS?
' Retrieved June 29, 2022.
One of the largest changes to the Windows API was the transition from Win16 (shipped in Windows 3.1 and older) to
Win32 (Windows NT and Windows 95 and up). While Win32 was originally introduced with
Windows NT 3.1 and
Win32s allowed use of a Win32 subset before Windows 95, it was not until Windows 95 that widespread porting of applications to Win32 began. To ease the transition, in Windows 95, for developers outside and inside Microsoft, a complex scheme of API
thunks was used that could allow 32-bit code to call into 16-bit code (for most of Win16 APIs) and vice versa. ''Flat thunks'' allowed 32-bit code to call into 16-bit libraries, and the scheme was used extensively inside Windows 95's libraries to avoid porting the whole OS to Win32 in one batch. In Windows NT, the OS was pure 32-bit, except parts for compatibility with 16-bit applications, and only generic thunks were available to thunk from Win16 to Win32, as for Windows 95. The Platform SDK shipped with a compiler that could produce the code needed for these thunks. Versions of 64-bit
Windows
Windows is a group of several proprietary graphical operating system families developed and marketed by Microsoft. Each family caters to a certain sector of the computing industry. For example, Windows NT for consumers, Windows Server for ...
are also able to run 32-bit applications via
WoW64
In computing on Microsoft platforms, WoW64 (Windows 32-bit on Windows 64-bit) is a subsystem of the Windows operating system capable of running 32-bit applications on 64-bit Windows. It is included in all 64-bit versions of Windows—including ...
. The SysWOW64 folder located in the Windows folder on the OS drive contains several tools to support 32-bit applications.
Versions
Almost every new version of Microsoft Windows has introduced its own additions and changes to the Windows API.
[The Iseran Project (1996–2001). ]
History of the Windows API.
' Retrieved October 7, 2005. The name of the API, however, remained consistent between different Windows versions, and name changes were kept limited to major architectural and platform changes for Windows. Microsoft eventually changed the name of the then current Win32 API family into Windows API and made it into a catch-all term for both past and future API versions.
* Win16 is the API for the first,
16-bit
16-bit microcomputers are microcomputers that use 16-bit microprocessors.
A 16-bit register can store 216 different values. The range of integer values that can be stored in 16 bits depends on the integer representation used. With the two mos ...
versions of
Microsoft Windows. These were initially referred to as simply the ''Windows API'', but were later renamed to Win16 in an effort to distinguish them from the newer, 32-bit version of the Windows API. The functions of Win16 API reside in mainly the core files of the OS: ''kernel.exe'' (or ''krnl286.exe'' or ''krnl386.exe''), ''user.exe'' and ''gdi.exe''. Despite the
file extension
A filename extension, file name extension or file extension is a suffix to the name of a computer file (e.g., .txt, .docx, .md). The extension indicates a characteristic of the file contents or its intended use. A filename extension is typically ...
of
exe, these actually are
dynamic-link libraries.
* Win32 is the
32-bit
In computer architecture, 32-bit computing refers to computer systems with a processor, memory, and other major system components that operate on data in 32- bit units. Compared to smaller bit widths, 32-bit computers can perform large calcula ...
application programming interface (API) for 32-bit versions of Windows (NT, 95, and later versions). The API consists of functions implemented, as with Win16, in system DLLs. The core DLLs of Win32 are
kernel32.dll,
user32.dll, and
gdi32.dll. Win32 was introduced with
Windows NT
Windows NT is a proprietary graphical operating system produced by Microsoft, the first version of which was released on July 27, 1993. It is a processor-independent, multiprocessing and multi-user operating system.
The first version of Wi ...
. The version of Win32 shipped with
Windows 95
Windows 95 is a consumer-oriented operating system developed by Microsoft as part of its Windows 9x family of operating systems. The first operating system in the 9x family, it is the successor to Windows 3.1x, and was released to manufactu ...
was initially referred to as Win32c, with ''c'' meaning ''compatibility''. This term was later abandoned by Microsoft in favor of Win32.
*
Win32s is an extension for the
Windows 3.1x family of Microsoft Windows that implemented a
subset
In mathematics, set ''A'' is a subset of a set ''B'' if all elements of ''A'' are also elements of ''B''; ''B'' is then a superset of ''A''. It is possible for ''A'' and ''B'' to be equal; if they are unequal, then ''A'' is a proper subset o ...
of the Win32 API for these systems. The "s" stands for "subset".
* Win64 is the variant of the API implemented on
64-bit
In computer architecture, 64-bit integers, memory addresses, or other data units are those that are 64 bits wide. Also, 64-bit CPUs and ALUs are those that are based on processor registers, address buses, or data buses of that size. A comp ...
platforms of the
Windows architecture (,
x86-64
x86-64 (also known as x64, x86_64, AMD64, and Intel 64) is a 64-bit version of the x86 instruction set, first released in 1999. It introduced two new modes of operation, 64-bit mode and compatibility mode, along with a new 4-level paging ...
and
AArch64
AArch64 or ARM64 is the 64-bit extension of the ARM architecture family.
It was first introduced with the Armv8-A architecture. Arm releases a new extension every year.
ARMv8.x and ARMv9.x extensions and features
Announced in October 2011, ...
).
Both 32-bit and 64-bit versions of an application can be still compiled from one
codebase, although some older APIs have been deprecated, and some of the APIs that were already deprecated in Win32 were removed. All memory
pointers are 64-bit by default (the
LLP64
In computer architecture, 64-bit integers, memory addresses, or other data units are those that are 64 bits wide. Also, 64-bit CPUs and ALUs are those that are based on processor registers, address buses, or data buses of that size. A compute ...
model), so the source code must be checked for compatibility with 64-bit
pointer arithmetic and rewritten as necessary.
* WinCE is the implementation of the Windows API for the
Windows CE
Windows Embedded Compact, formerly Windows Embedded CE, Windows Powered and Windows CE, is an operating system subfamily developed by Microsoft as part of its Windows Embedded family of products.
Unlike Windows Embedded Standard, which is ba ...
operating system.
Other implementations
The
Wine
Wine is an alcoholic drink typically made from fermented grapes. Yeast consumes the sugar in the grapes and converts it to ethanol and carbon dioxide, releasing heat in the process. Different varieties of grapes and strains of yeasts are ...
project provides a Win32 API
compatibility layer for
Unix-like
A Unix-like (sometimes referred to as UN*X or *nix) operating system is one that behaves in a manner similar to a Unix system, although not necessarily conforming to or being certified to any version of the Single UNIX Specification. A Unix-li ...
platforms, between
Linux kernel API
The Linux kernel provides several interfaces to user-space applications that are used for different purposes and that have different properties by design. There are two types of application programming interface (API) in the Linux kernel tha ...
and programs written for the Windows API.
ReactOS
ReactOS is a free and open-source operating system for amd64/ i686 personal computers intended to be binary-compatible with computer programs and device drivers made for Windows Server 2003 and later versions of Windows. ReactOS has been noted ...
goes a step further and aims to implement the full Windows operating system, working closely with the Wine project to promote code re-use and compatibility.
DosWin32
A DOS extender is a computer software program running under DOS that enables software to run in a protected mode environment even though the host operating system is only capable of operating in real mode.
DOS extenders were initially developed ...
and
HX DOS Extender are other projects which emulate the Windows API to allow executing simple Windows programs from a
DOS command line.
Odin is a project to emulate Win32 on
OS/2
OS/2 (Operating System/2) is a series of computer operating systems, initially created by Microsoft and IBM under the leadership of IBM software designer Ed Iacobucci. As a result of a feud between the two companies over how to position OS/2 ...
, superseding the original Win-OS/2 emulation which was based on Microsoft code. Other minor implementations include the MEWEL and
Zinc
Zinc is a chemical element with the symbol Zn and atomic number 30. Zinc is a slightly brittle metal at room temperature and has a shiny-greyish appearance when oxidation is removed. It is the first element in group 12 (IIB) of the periodic t ...
libraries which were intended to implement a subset of the Win16 API on DOS (see
List of platform-independent GUI libraries).
Windows Interface Source Environment (WISE) was a licensing program from Microsoft which allowed developers to recompile and run Windows-based applications on
Unix
Unix (; trademarked as UNIX) is a family of multitasking, multiuser computer operating systems that derive from the original AT&T Unix, whose development started in 1969 at the Bell Labs research center by Ken Thompson, Dennis Ritchie, a ...
and
Macintosh
The Mac (known as Macintosh until 1999) is a family of personal computers designed and marketed by Apple Inc. Macs are known for their ease of use and minimalist designs, and are popular among students, creative professionals, and software en ...
platforms. WISE SDKs were based on an emulator of the Windows API that could run on those platforms.
WISE
Efforts toward standardization included Sun's Public Windows Interface (PWI) for Win16 (see also: Sun Windows Application Binary Interface ( Wabi)), Willows Software's Application Programming Interface for Windows (APIW) for Win16 and Win32 (see also: Willows TWIN The Application Programming Interface for Windows (APIW) Standard is a specification of the Microsoft Windows 3.1 API drafted by Willows Software. It is the successor to previously proposed Public Windows Interface standard. It was created in an a ...
), and ECMA-234, which attempted to standardize the Windows API bindingly.
Compiler support
To develop software that uses the Windows API, a compiler must be able to use the Microsoft-specific DLLs listed above (COM-objects are outside Win32 and assume a certain vtable layout). The compiler must either handle the header files that expose the interior API function names, or supply such files.
For the language C++, Zortech (later Symantec Symantec may refer to:
*An American consumer software company now known as Gen Digital Inc.
*A brand of enterprise security software purchased by Broadcom Inc.
Broadcom Inc. is an American designer, developer, manufacturer and global supplier ...
, then Digital Mars
Digital Mars is a small American software company owned by Walter Bright and based in Vienna, Virginia, that makes C, C++ and D compilers, and associated utilities such as an integrated development environment (IDE) for Windows and DOS, wh ...
), Watcom and Borland have all produced well known commercial compilers that have been used often with Win16, Win32s, and Win32. Some of them supplied ''memory extenders'', allowing Win32 programs to run on Win16 with Microsoft's redistributable Win32s DLL. The Zortech compiler was probably one of the first stable and usable C++ compilers for Windows programming, before Microsoft had a C++ compiler.
For certain classes of applications, the compiler system should also be able to handle interface description language
interface description language or interface definition language (IDL), is a generic term for a language that lets a program or object written in one language communicate with another program written in an unknown language. IDLs describe an inter ...
(IDL) files. Collectively, these prerequisites (compilers, tools, libraries, and headers) are known as the '' Microsoft Platform SDK''. For a time, the Microsoft Visual Studio
Visual Studio is an integrated development environment (IDE) from Microsoft. It is used to develop computer programs including websites, web apps, web services and mobile apps. Visual Studio uses Microsoft software development platforms such ...
and Borland's integrated development system were the only integrated development environment
An integrated development environment (IDE) is a software application that provides comprehensive facilities to computer programmers for software development. An IDE normally consists of at least a source code editor, build automation tools a ...
s (IDEs) that could provide this (although, the SDK is downloadable for free separately from the entire IDE suite, fro
Microsoft Windows SDK for Windows 7 and .NET Framework 4
.
, the MinGW and Cygwin
Cygwin ( ) is a POSIX-compatible programming and runtime environment that runs natively on Microsoft Windows. Under Cygwin, source code designed for Unix-like operating systems may be compiled with minimal modification and executed.
The Cygwin i ...
projects also provide such an environment based on the GNU Compiler Collection
The GNU Compiler Collection (GCC) is an optimizing compiler produced by the GNU Project supporting various programming languages, hardware architectures and operating systems. The Free Software Foundation (FSF) distributes GCC as free sof ...
(GCC), using a stand-alone header file set, to make linking against the Win32-specific DLLs simple. LCC-Win32 is a C compiler maintained by Jacob Navia, freeware
Freeware is software, most often proprietary, that is distributed at no monetary cost to the end user. There is no agreed-upon set of rights, license, or EULA that defines ''freeware'' unambiguously; every publisher defines its own rules for t ...
for non-commercial use. Pelles C is a freeware C compiler maintained by Pelle Orinius. Free Pascal
Free Pascal Compiler (FPC) is a compiler for the closely related programming-language dialects Pascal and Object Pascal. It is free software released under the GNU General Public License, witexception clausesthat allow static linking against i ...
is a free software
Free software or libre software is computer software distributed under terms that allow users to run the software for any purpose as well as to study, change, and distribute it and any adapted versions. Free software is a matter of liberty, ...
Object Pascal
Object Pascal is an extension to the programming language Pascal that provides object-oriented programming (OOP) features such as classes and methods.
The language was originally developed by Apple Computer as ''Clascal'' for the Lisa Work ...
compiler that supports the Windows API. The MASM32 package is a mature project providing support for the Windows API under Microsoft Macro Assembler (MASM) by using custom made or converted headers and libraries from the Platform SDK. Flat assembler FASM
FASM (''flat assembler'') is an assembler for x86 processors. It supports Intel-style assembly language on the IA-32 and x86-64 computer architectures. It claims high speed, size optimizations, operating system (OS) portability, and macro a ...
allows building Windows programs without using an external linker, even when running on Linux.
Windows specific compiler support is also needed for Structured Exception Handling (SEH). This system serves two purposes: it provides a substrate on which language-specific exception handling
In computing and computer programming, exception handling is the process of responding to the occurrence of ''exceptions'' – anomalous or exceptional conditions requiring special processing – during the execution of a program. In general, a ...
can be implemented, and it is how the kernel notifies applications of exceptional conditions such as dereferencing an invalid pointer or stack overflow. The Microsoft/Borland C++ compilers had the ability to use this system as soon as it was introduced in Windows 95 and NT, however the actual implementation was undocumented and had to be reverse engineered for the Wine project and free compilers. SEH is based on pushing exception handler frames onto the stack, then adding them to a linked list stored in thread-local storage (the first field of the thread environment block). When an exception is thrown, the kernel and base libraries unwind the stack running handlers and filters as they are encountered. Eventually, every exception unhandled by the application will be dealt with by the default backstop handler, which pops up the Windows common crash dialog.
See also
* Windows Libraries for OS/2
* Interix
* Linux kernel API
The Linux kernel provides several interfaces to user-space applications that are used for different purposes and that have different properties by design. There are two types of application programming interface (API) in the Linux kernel tha ...
* Microsoft Windows library files
* Windows legacy audio components
* C++/WinRT, a library providing access to Windows Runtime
Notes
References
External links
MSDN Windows API index
Windows API Microsoft Code Samples
– ECMA
Ecma International () is a nonprofit standards organization for information and communication systems. It acquired its current name in 1994, when the European Computer Manufacturers Association (ECMA) changed its name to reflect the organizatio ...
standard for a subset of the Windows API
* ews://comp.os.ms-windows.programmer.win32 Advanced Win32 API newsgroup* ews://fr.comp.os.ms-windows.programmation French Win32 API newsgroup
{{DEFAULTSORT:Windows Api
Microsoft application programming interfaces
Articles with example C code