All Topics  
Windows API

 

   Email Print
   Bookmark   Link






 

Windows API



 
 
The Windows API, informally WinAPI, is Microsoft's core set of application programming interface
Application programming interface

An application programming interface is a set of subroutine, data structures, class and/or Protocol provided by library and/or operating system Service s in order to support the building of applications....
s (APIs) available in the Microsoft Windows
Microsoft Windows

Microsoft Windows is a series of software operating systems and graphical user interfaces produced by Microsoft. Microsoft first introduced an operating environment named Windows in November 1985 as an add-on to MS-DOS in response to the growing interest in graphical user interfaces ....
 operating systems. It was formerly called the Win32 API; however, the name Windows API more accurately reflects its roots in 16-bit Windows and its support on 64-bit Windows. Almost all Windows programs interact with the Windows API; a small number (such as programs started early in the Windows startup process
Windows NT Startup Process

The Windows NT startup process is the process by which Microsoft's Windows NT, Windows 2000, Windows XP and Windows Server 2003 operating systems initialize....
) use the Native API
Native API

The Native API is the publicly incompletely documented application programming interface used internally by the Windows NT family of operating systems produced by Microsoft....
 .

The Microsoft Windows SDK (Software Development Kit) is available for Windows, which provides documentation and tools to enable developers to create software using the Windows API and associated Windows technologies.

functionality provided by the Windows API can be grouped into eight categories:

Base Services: Provide access to the fundamental resources available to a Windows system.






Discussion
Ask a question about 'Windows API'
Start a new discussion about 'Windows API'
Answer questions from other users
Full Discussion Forum



Encyclopedia


The Windows API, informally WinAPI, is Microsoft's core set of application programming interface
Application programming interface

An application programming interface is a set of subroutine, data structures, class and/or Protocol provided by library and/or operating system Service s in order to support the building of applications....
s (APIs) available in the Microsoft Windows
Microsoft Windows

Microsoft Windows is a series of software operating systems and graphical user interfaces produced by Microsoft. Microsoft first introduced an operating environment named Windows in November 1985 as an add-on to MS-DOS in response to the growing interest in graphical user interfaces ....
 operating systems. It was formerly called the Win32 API; however, the name Windows API more accurately reflects its roots in 16-bit Windows and its support on 64-bit Windows. Almost all Windows programs interact with the Windows API; a small number (such as programs started early in the Windows startup process
Windows NT Startup Process

The Windows NT startup process is the process by which Microsoft's Windows NT, Windows 2000, Windows XP and Windows Server 2003 operating systems initialize....
) use the Native API
Native API

The Native API is the publicly incompletely documented application programming interface used internally by the Windows NT family of operating systems produced by Microsoft....
 .

The Microsoft Windows SDK (Software Development Kit) is available for Windows, which provides documentation and tools to enable developers to create software using the Windows API and associated Windows technologies.

Overview

The functionality provided by the Windows API can be grouped into eight categories:

Base Services: Provide access to the fundamental resources available to a Windows system. Included are things like file systems, devices
Computer hardware

A personal computer is made up of computer hardware, multiple physical components onto which can be loaded into a multitude of software that perform the functions of the computer....
, processes
Process (computing)

In computing, a process is an Object of a computer program that is being sequentially executed by a computer system that has the ability to run several computer programs Concurrency ....
 and threads
Thread (computer science)

In computer science, a thread of execution is a Fork of a computer program into two or more Concurrency running task s. The implementation of threads and process es differs from one operating system to another, but in most cases, a thread is contained inside a process....
, and error handling. These functions reside in kernel.exe, krnl286.exe or krnl386.exe files on 16-bit Windows, and kernel32.dll
Kernel32.dll

Kernel32.dll is a dynamic link library present in all 32-bit and 64-bit versions of Microsoft Windows. It exposes to applications most of the Win32 base APIs, such as memory management, input/output operations, creation, and synchronization functions....
on 32-bit Windows. Advanced Services
Provide access to functionality that is an addition on the kernel. Included are things like the Windows registry
Windows registry

The Windows Registry is a directory which stores settings and options for Microsoft Windows operating systems. It contains information and settings for all the hardware, operating system software, most non-operating system software, and per-user settings....
, shutdown/restart the system (or abort), start/stop/create a Windows service
Windows Service

On Microsoft Windows operating systems, a Windows service is a long-running executable that performs specific functions and which is designed not to require user intervention....
, manage user accounts. These functions reside in advapi32.dll on 32-bit Windows.
Graphics Device Interface: Provides functionality for outputting graphical content to monitors
Computer display

A visual display unit, often called simply a monitor or display, is a piece of electrical equipment which displays images generated from the video output of devices such as computers, without producing a permanent record....
, printers
Computer printer

File:Lexmark X5100 Series.jpgIn computing, a printer is a peripheral which produces a hard copy of documents stored in computer file form, usually on physical print media such as paper or Transparency ....
 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: Provides the functionality to create and manage screen window
Window (computing)

In computing, a window is a visual area, usually rectangular in shape, containing some kind of user interface, displaying the output of and allowing input for one of a number of simultaneously running computer processes....
s and most basic controls, such as button
Button (computing)

In computing, a button is a user interface element that provides the user a simple way to trigger an event , like searching for a query at a search engine, or to interact with dialog boxes, like confirming an action....
s and scrollbar
Scrollbar

A scrollbar is a graphical object in a GUI with which continuous text, pictures or anything else can be Scrolling including time in video applications, i.e., viewed even if it does not fit into the space in a computer display, window , or viewport....
s, receive mouse and keyboard input, and other functionality associated with the GUI
Gui

Gui or guee is a generic term to refer to grillinged dishes in Korean cuisine. These most commonly have meat or fish as their primary ingredient, but may in some cases also comprise grilled vegetables or other vegetarian ingredients....
 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

Windows XP is a line of operating systems produced by Microsoft for use on personal computers, including home and business desktops, laptop, and media centers....
 versions, the basic controls reside in comctl32.dll, together with the common controls (Common Control Library). Common Dialog Box Library: Provides applications the standard dialog box
Dialog box

In graphical user interfaces, a dialog box is a special Window , used in user interfaces to display information to the user, or to get a response if needed....
es for opening and saving files, choosing 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: Gives applications access to some advanced controls provided by the operating system. These include things like status bar
Status bar

A status bar, similar to a status line, is an information area typically found at the bottom of Window s in a graphical user interface.A status bar is sometimes divided into sections, each of which shows different information....
s, progress bar
Progress bar

A progress bar is a component in a graphical user interface used to convey the progress of a task, such as a download or file transfer. Often, the graphic is accompanied by a textual representation of the progress in a percent format....
s, toolbar
Toolbar

In a graphical user interface on a computer monitor a toolbar is a panel on which onscreen buttons, icons, menus or other input or output elements are placed....
s and tab
Tab (GUI)

In graphical user interfaces, a tab is a navigational Widget for switching between sets of controls or documents. It is traditionally designed as a text label within a rectangular box with its top borders rounded....
s. The library resides in a DLL
Dynamic-link library

Dynamic-link library , or DLL, is Microsoft's implementation of the shared library concept in the Microsoft Windows and OS/2 operating systems....
 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: Component of the Windows API allows applications to access the functionality provided by the operating system shell, as well as change and enhance it. The component resides in shell.dll on 16-bit Windows, and shell32.dll and later in Windows 95
Windows 95

Windows 95 is a consumer-oriented graphical user interface-based operating system. It was released on August 24, 1995 by Microsoft, and was a significant progression from the company's previous Microsoft Windows products....
 shlwapi.dll on 32-bit Windows. It is grouped under the User Interface category of the API. Network Services: Give access to the various networking
Computer network

A computer network is a group of interconnected computers. Networks may be classified according to a wide variety of characteristics. This article provides a general overview of some types and categories and also presents the basic components of a network....
 capabilities of the operating system. Its sub-components include NetBIOS
NetBIOS

NetBIOS is an acronym for Network Basic Input/Output System. It provides services related to the session layer of the OSI model allowing applications on separate computers to communicate over a local area network....
, Winsock
Winsock

In computer, the Windows Sockets API, which was later shortened to Winsock, is a technical specification that defines how Microsoft Windows computer network computer software should access protocol stacks, especially TCP/IP....
, NetDDE, RPC
Remote procedure call

Remote procedure call is an Inter-process communication technology that allows a computer program to cause a subroutine or procedure to execute in another address space without the programmer explicitly coding the details for this remote interaction....
 and many others.

Web

The Internet Explorer
Internet Explorer

Windows Internet Explorer , commonly abbreviated to IE, is a series of graphical user interface web browsers developed by Microsoft and included as part of the Microsoft Windows line of operating systems starting in 1995....
 web browser also exposes many APIs that are often used by applications, and as such could be considered a part of the Windows API. Internet Explorer has been included with the operating system since Windows 98 second edition, and has provided web related services to applications since Windows 98
Windows 98

Windows 98 is a graphical operating system released on 25 June 1998 by Microsoft and the successor to Windows 95. Like its predecessor, it is a hybrid 16-bit application/32-bit application monolithic product based on MS-DOS....
. Specifically, it used to provide:
  • An embeddable web browser control, contained in shdocvw.dll and mshtml.dll
    Trident (layout engine)

    Trident is the name of the layout engine for the Microsoft Windows version of Internet Explorer. It was first introduced with the release of Internet Explorer 4 in October 1997; it has been steadily upgraded and remains in use today....
    .
  • The URL monitor 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.
  • A library for assisting with multi-language and international text support (mlang.dll).
  • DirectX Transforms, a set of image filter components.
  • XML support (the MSXML components).
  • Access to the Windows Address Book.


Multimedia

Microsoft has provided the DirectX
DirectX

Microsoft DirectX is a collection of application programming interfaces for handling tasks related to multimedia, especially game programming and video, on Microsoft platforms....
 set of APIs as part of every Windows installation since Windows 95
Windows 95

Windows 95 is a consumer-oriented graphical user interface-based operating system. It was released on August 24, 1995 by Microsoft, and was a significant progression from the company's previous Microsoft Windows products....
 OSR2. DirectX provides a loosely related set of multimedia and gaming services, including:
  • Direct3D
    Direct3D

    Direct3D is part of Microsoft's DirectX application programming interface. Direct3D is only available for Microsoft's various Microsoft Windows operating systems and is the base for the graphics API on the Xbox and Xbox 360 console systems....
     for access to 3D hardware accelerated graphics.
  • DirectDraw
    DirectDraw

    DirectDraw is part of Microsoft's DirectX application programming interface. DirectDraw is used to render Computer graphics in applications where top performance is important....
     for hardware accelerated access to the 2D framebuffer. As of DirectX 9, this component has been deprecated in favor of Direct3D, which provides more general high-performance graphics functionality (as 2D rendering is a subset of 3D rendering).
  • DirectSound
    DirectSound

    DirectSound is a software component of the DirectX library, supplied by Microsoft, that resides on a computer with the Microsoft Windows operating system....
     for low level hardware accelerated sound card access.
  • DirectInput
    DirectInput

    DirectInput is a Microsoft API for collecting input from the user, via list of input devices such the computer mouse, computer keyboard, joystick or other game controllers....
     for communication with input devices such as joysticks and gamepads.
  • DirectPlay
    DirectPlay

    DirectPlay is part of Microsoft's DirectX API. DirectPlay is a network communication library intended for computer game development, although its general nature certainly allows it to be used for other purposes....
     as a multiplayer gaming infrastructure. This component has been deprecated as of DirectX 9 and Microsoft no longer recommends its use for game development.
  • DirectShow
    DirectShow

    DirectShow , codename Quartz, is a multimedia framework and application programming interface produced by Microsoft for software developers to perform various operations with media files or streams....
     which builds and runs generic multimedia pipelines. It is comparable to the GStreamer
    GStreamer

    GStreamer is a Pipeline based multimedia framework written in the C with the type system based on GObject. GStreamer allows a programmer to create a variety of media-handling components, including simple Audio frequency playback, audio and video...
     framework and is often used to render in-game videos and build media players (Windows Media Player
    Windows Media Player

    Windows Media Player is a digital media media player and media library application developed by Microsoft that is used for playing sound reproduction, video and viewing s on personal computers running the Microsoft Windows operating system, as well as on Pocket PC and Windows Mobile-based devices....
     is based upon it). DirectShow is no longer recommended for game development.
  • DirectMusic
    DirectMusic

    DirectMusic is a deprecated component of the Microsoft DirectX API that allows music and sound effects to be composed and played and provides flexible interactive control over the way they are played....


Program interaction

The Windows API mostly concerns itself with the interaction between the operating system
Operating system

An operating system is an interface between hardware and applications; it is responsible for the management and coordination of activities and the sharing of the limited resources of the computer....
 and an application. For communication between the different Windows applications among themselves, Microsoft has developed a series of technologies alongside the main Windows API. This started out with Dynamic Data Exchange
Dynamic Data Exchange

Dynamic Data Exchange is a technology for communication between multiple applications under Microsoft Windows or OS/2....
 (DDE), which was superseded by Object Linking and Embedding
Object Linking and Embedding

Object Linking and Embedding is a technology that allows embedding and linking to documents and other objects developed by Microsoft. For developers, it brought OLE custom controls , a way to develop and use custom user interface elements....
 (OLE) and later by the Component Object Model
Component Object Model

Component Object Model is an interface standard for software componentry introduced by Microsoft in 1993. It is used to enable interprocess communication and dynamic object creation in a large range of programming languages....
 (COM).

Wrapper libraries

Various wrapper
Wrapper

The term wrapper generally refers to a type of packaging, such as a flat sheet made out of paper, cellophane, or plastic to enclose an object....
s 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
Microsoft Foundation Class Library

The Microsoft Foundation Class Library is a Library that wrapper portions of the Windows API in C++ Class , including functionality that enables them to use a default application framework....
 (MFC) wrapped Windows API functionality in C++
C++

C++ is a general-purpose programming language. It is regarded as a middle-level language, as it comprises a combination of both high-level programming language and low-level programming language language features....
 classes
Class (computer science)

In object-oriented programming, a class is a programming language construct that is used as a blueprint to create Object s. This blueprint includes Attribute s and Method s that the created objects all share....
, and thus allows a more object oriented
Object-oriented programming

Object-oriented programming is a programming paradigm that uses "Object_" and their interactions to design applications and computer programs....
 way of interacting with the API. The Active Template Library (ATL) is a template
Template (programming)

Templates are a feature of the C++ programming language that allow functions and classes to operate with Generic programming. This allows a function or class to work on many different datatype without being rewritten for each one....
 oriented wrapper for COM. The Windows Template Library
Windows Template Library

The Windows Template Library is a free software, Object-oriented programming C++ template Library for Win32 development. WTL was created by Microsoft employee Nenad Stefanovic for internal use and later released as an unsupported add-on to Visual Studio and the Win32 Framework SDK....
 (WTL) was developed as an extension to ATL, and intended as a lightweight alternative to MFC.

Also notable are some of Borland's
Borland

Borland Software Corporation is a Computer software company headquartered in Austin, Texas. It was founded in 1983 by Niels Jensen, Ole Henriksen, Mogens Glad and Philippe Kahn....
 offerings. Object Windows Library
Object Windows Library

The Object Windows Library is a Borland C++ object-oriented framework originally designed for Windows API. It was used in Turbo Pascal for Windows, Borland Pascal and their Borland C++ package....
 (OWL) was released as a competing product to MFC, and offered a similar object-oriented wrapper. Borland later deprecated
Deprecation

In computer software standards and documentation, the term deprecation is applied to software features that are superseded and should be avoided....
 it in favour of the Visual Component Library
Visual Component Library

VCL is a visual software component-based framework for developing Microsoft Windows applications, developed by Borland for use in its Delphi programming language and C++ Builder software development environment....
 (VCL), which is written in Object Pascal
Object Pascal

Object Pascal refers to a branch of Object-oriented programming derivatives of Pascal , mostly known as the primary programming language of CodeGear Delphi....
 and available in both Delphi
Borland Delphi

Delphi is a software development environment for Microsoft Windows applications. It has always supported development of native Windows applications in the Delphi programming language, a further development of Object Pascal....
 and C++ Builder
C++ Builder

C++ Builder is a rapid application development environment produced by the CodeGear subsidiary of Embarcadero Technologies for writing programs in the C++ programming language....
.

Most application framework
Application framework

In computer programming, an application framework is a software framework that is used to implement the standard structure of an application software for a specific operating system....
s for Windows are (at least partially) wrapping the Windows API. Thus, the .NET Framework
.NET Framework

The Microsoft .NET Framework is a software framework that is available with several Microsoft Windows operating systems. It includes a large Library of coded solutions to prevent common programming problems and a virtual machine that manages the execution of programs written specifically for the Software framework....
 and Java
Java (programming language)

Java is a programming language originally developed by James Gosling at Sun Microsystems and released in 1995 as a core component of Sun Microsystems' Java ....
, as well as any other programming languages 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 the programmer. This has had the advantage of giving Windows programmers a great deal of flexibility and power over their applications. However, it also has given Windows applications a great deal of responsibility in handling various low-level, sometimes tedious, operations that are associated with a graphical user interface
Graphical user interface

A graphical user interface is a type of user interface which allows people to human-computer interaction such as computers; hand-held devices such as MP3 Players, Portable Media Players or Gaming devices; household appliances and office equipment....
.

Charles Petzold
Charles Petzold

Charles Petzold is an United States programmer and technical author on Microsoft Windows applications. He is also a Microsoft Most Valuable Professional....
, writer of well-read Windows API books, has said: "The original hello world program
Hello world program

A "Hello World" program is a computer program that prints out "Hello world!" on a display device. It is used in many introductory tutorials for teaching a programming language....
 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 C programmers often curled up in horror or laughter when encountering the Windows hello-world program."

Over the years, various changes and additions were made to the Windows Operating System, and the Windows API changed and grew to reflect this. The Windows API for Windows 1.0
Windows 1.0

Windows 1.0 is a 16-bit graphical operating environment that was released on 20 November 1985. It was Microsoft's first attempt to implement a Computer multitasking graphical user interface-based operating environment on the personal computer platform....
 supported fewer than 450 function calls
Subroutine

In computer science, a subroutine or subprogram is a portion of computer code within a larger computer program, which performs a specific task and is relatively independent of the remaining code....
, where in modern versions of the Windows API there are 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.

A large emphasis has been put by Microsoft
Microsoft

Microsoft Corporation is a multinational corporation computer technology corporation that develops, manufactures, licenses, and supports a wide range of computer software products for computing devices....
 on maintaining software backwards compatibility. To achieve this, Microsoft sometimes even went as far as supporting software that was using the API in an undocumented or even (programmatically) illegal way. Raymond Chen
Raymond Chen

Raymond Chen is a well-known developer on the Microsoft Windows Windows Shell team at Microsoft. Since joining Microsoft in 1992, Chen has worked on OS/2, Windows 95, DirectX, and later versions of Windows....
, 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."

One of the largest changes the Windows API underwent 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
Windows NT 3.1

Windows NT 3.1 is the first release of Microsoft's Windows NT line of Server and business desktop operating systems, and was released to manufacturing on 27 July 1993....
 and Win32s
Win32s

Win32s is a 32-bit application runtime environment for the Microsoft Microsoft Windows Windows 3.1x operating system. It allowed some 32-bit applications to run on the 16-bit operating system using call thunks....
 allowed usage of a Win32 subset before Windows 95, it was not until Windows 95 that many applications began being ported to Win32. To ease the transition, in Windows 95, both for external developers and for Microsoft itself, a complex scheme of API thunk
Thunk

The word thunk has at least three related meanings in computer science. A "thunk" may be:* a piece of code to perform a delayed computation * a feature of some virtual function table implementations ...
s was used that could allow 32 bit code to call into 16 bit code and (in limited cases) vice-versa. So-called flat thunks allowed 32 bit code to call into 16 bit libraries, and the scheme was used extensively inside Windows 95 to avoid porting the whole OS to Win32 itself in one chunk. In Windows NT, the OS was pure 32-bit (except the parts for compatibility with 16-bit applications) and the only thunk available was generic thunks which only thunks from Win16 to Win32 and worked in Windows 95 too. The Platform SDK shipped with a compiler that could produce the code necessary for these thunks.

Versions

Almost every new version of Microsoft Windows has introduced its own additions and changes to the Windows API. The name of the API however was kept consistent between different Windows version, 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 versions of the API.
  • Win16 is the API for the first, 16-bit
    16-bit

    16-bit architectureThe HP 2100#Descendants and variants , introduced in 1975, was the world's first 16-bit microprocessor.Prominent 16-bit processors include the PDP-11, Intel 8086, Intel 80286 and the WDC 65C816....
     versions of Microsoft Windows
    Microsoft Windows

    Microsoft Windows is a series of software operating systems and graphical user interfaces produced by Microsoft. Microsoft first introduced an operating environment named Windows in November 1985 as an add-on to MS-DOS in response to the growing interest in graphical user interfaces ....
    . These were initially referred to as simply the Windows API, but were later renamed to Win16 in an effort to distinguish it from the newer, 32-bit version of the Windows API. The functions of Win16 API mainly reside in the core files of the OS: kernel.exe (or krnl286.exe or krnl386.exe), user.exe and gdi.exe. Despite the file extension of exe, these actually are dynamically linked libraries.
  • Win32 is the 32-bit
    32-bit

    The range of integer values that can be stored in 32 bits is 0 through 4,294,967,295 or -2,147,483,648 through 2,147,483,647 using two's complement encoding....
     API
    Application programming interface

    An application programming interface is a set of subroutine, data structures, class and/or Protocol provided by library and/or operating system Service s in order to support the building of applications....
     for modern versions of Windows. The API consists of functions implemented, as with Win16, in system DLLs. The core DLLs of Win32 are kernel32.dll
    Kernel32.dll

    Kernel32.dll is a dynamic link library present in all 32-bit and 64-bit versions of Microsoft Windows. It exposes to applications most of the Win32 base APIs, such as memory management, input/output operations, creation, and synchronization functions....
    , user32.dll, and gdi32.dll. Win32 was introduced with Windows NT
    Windows NT

    Windows NT is a family of operating systems produced by Microsoft, the first version of which was released in July 1993. It was originally designed to be a powerful high-level-language-based, processor-independent, multiprocessing, multiuser operating system with features comparable to Unix....
    . The version of Win32 that was shipped with Windows 95
    Windows 95

    Windows 95 is a consumer-oriented graphical user interface-based operating system. It was released on August 24, 1995 by Microsoft, and was a significant progression from the company's previous Microsoft Windows products....
     was initially referred to as Win32c, with the "c" standing for "compatibility", but this term was later abandoned by Microsoft in favour of Win32.
  • Win32s
    Win32s

    Win32s is a 32-bit application runtime environment for the Microsoft Microsoft Windows Windows 3.1x operating system. It allowed some 32-bit applications to run on the 16-bit operating system using call thunks....
     is an extension for the Windows 3.1x
    Windows 3.1x

    Windows 3.1x is a line of operating systems produced by Microsoft for use on personal computers. The line began with Windows 3.1, which was released in March 1992 as a successor to Windows 3.0....
     family of Microsoft Windows that implemented a subset
    Subset

    In mathematics, especially in set theory, a Set A is a subset of a set B if A is "contained" inside B. Notice that A and B may coincide....
     of the Win32 API for these systems. The "s" stands for "subset".
  • Win32 for 64-bit Windows, previously known as Win64, is the variant of the API implemented on 64-bit
    64-bit

    64-bit CPUs have existed in supercomputers since the 1960s and in RISC-based computer workstation and Server s since the early 1990s. In 2003 they were introduced to the mainstream personal computer arena, in the form of the x86-64 and 64-bit PowerPC processor architectures....
     platforms
    Windows NT

    Windows NT is a family of operating systems produced by Microsoft, the first version of which was released in July 1993. It was originally designed to be a powerful high-level-language-based, processor-independent, multiprocessing, multiuser operating system with features comparable to Unix....
     of the Windows architecture
    Architecture of the Windows NT operating system line

    The architecture of Windows NT, a line of operating systems produced and sold by Microsoft, is a layered design that consists of two main components, user mode and kernel mode....
     (currently AMD64
    X86-64

    x86-64 is a superset of the x86. x86-64 Central processing units can run existing 32-bit or 16-bit x86 programs at full speed, but also support new programs written with a 64-bit address space and other additional capabilities....
     and IA64.) There are no new user-mode functions specific to the 64-bit platform, so both 32-bit and 64-bit versions of an application can be still compiled from a single codebase
    Codebase

    The term codebase, or code base is used in software development to mean the whole collection of source code used to build a particular application software or Software componentry....
    , although some older APIs have been deprecated. All memory pointers are 64-bit by default (the LLP64 model), so the source code has to be checked for compatibility with 64-bit pointer arithmetic and rewritten as necessary .


Other implementations

Although Microsoft's implementation of the Windows API is copyrighted, it is generally accepted due to legal precedents in the United States that other vendors can emulate Windows by providing an identical API without breaching copyright.

The Wine
Wine (software)

Wine is a free software software application that aims to allow Unix-like computer operating systems on the x86 architecture or x86-64 architecture to execute programs written for Microsoft Windows....
 project is an attempt to provide a Win32 API Compatibility layer
Compatibility layer

A compatibility layer is a term that refers to components that allow for non-native support of components.In software engineering, a compatibility layer allows binaries for a foreign system to run on a host system....
 for Unix-like
Unix-like

A Unix-like operating system is one that behaves in a manner similar to a Unix system, while not necessarily conforming to or being certified to any version of the Single UNIX Specification....
 platforms. ReactOS
ReactOS

ReactOS is a computer operating system intended to be Application binary interface with application software and device drivers made for Microsoft Windows NT versions 5.x and up ....
 goes a step further and aims to provide an implementation of the entire Windows operating system, working closely with the Wine project to promote code re-use and compatibility. HX DOS-Extender
HX DOS Extender

HX DOS-Extender is a free DOS extender with built-in Win32 Portable Executable support. Usually the purpose of a DOS extender is to make protected mode features, especially large memory and 32-bit addressing, available for DOS applications....
 is another project to emulate the Windows API, to allow running simple Windows programs from a DOS
DOS

DOS, short for "Disk Operating System", is a shorthand term for several closely related operating systems that dominated the IBM PC compatible market between 1981 and 1995, or until about 2000 if one includes the partially DOS-based Microsoft Windows versions Windows 95, Windows 98, and Windows Me....
 command line. Odin
Odin (software)

In computing, Odin is a project to run Microsoft Windows programs on OS/2 or convert them to OS/2 native format. It also provides the Odin32 application programming interface to compile Win32 programs for OS/2....
 is a project to emulate Win32 on top of OS/2
OS/2

OS/2 is a computer operating system, initially created by Microsoft and IBM, then later developed by IBM exclusively. The name stands for "Operating System/2," because it was introduced as part of the same generation change release as IBM's "IBM Personal System/2 " line of second-generation personal computers....
.

Compiler support

To develop software that utilizes the Windows API, a compiler must be able to handle and import the Microsoft-specific DLLs and COM-objects. The compiler must either handle the header files that expose the interior API function names, or supply such files by itself. For certain classes of applications, the compiler system should also be able to handle IDL
Interface description language

An interface description language , or IDL for short, is a specification language used to describe a software component's Interface . IDLs describe an interface in a language-neutral way, enabling communication between software components that do not share a language – for example, between components written in C++ and components...
 (interface definition language) files. Collectively, these prerequisites (compilers, tools, libraries, and headers) are known as the Microsoft Platform SDK
Microsoft Platform SDK

The Microsoft Windows SDK is a software development kit from Microsoft that contains header files, Library , samples, documentation and tools utilizing the Application programming interface required to software development Application software for Microsoft Windows and the .NET Framework 3.0/.NET Framework 3.5....
.
For a long time the proprietary Microsoft Visual Studio
Microsoft Visual Studio

Microsoft Visual Studio is an integrated development environment from Microsoft. It can be used to develop Console application and graphical user interface applications along with Windows Forms applications, web sites, web applications, and web services in both native code together with managed code for all platforms supported by Microsoft W...
 family of compiler
Compiler

A compiler is a computer program that transforms source code written in a programming language into another computer language . The most common reason for wanting to transform source code is to create an executable program....
s and tools and Borland
Borland

Borland Software Corporation is a Computer software company headquartered in Austin, Texas. It was founded in 1983 by Niels Jensen, Ole Henriksen, Mogens Glad and Philippe Kahn....
's compilers were the only tools that could provide this (although at least in the case of Windows, the SDK itself is downloadable for free separately from the entire IDE
Integrated development environment

An integrated development environment also known as integrated design environment or integrated debugging environment is a software application that provides comprehensive facilities to computer programmers for software development....
 suite, from ). Nowadays the MinGW
MinGW

MinGW , formerly mingw32, is a native porting of the GNU Compiler Collection to Microsoft Windows, along with a set of freely distributable import libraries and header files for the Windows API....
 and Cygwin
Cygwin

Cygwin is a Unix-like environment and command-line interface for Microsoft Windows. Cygwin provides native integration of Windows-based applications, data, and other system resources with applications, software tools, and data of the Unix-like environment....
 projects also provide such an environment based on the GNU Compiler Collection
GNU Compiler Collection

The GNU Compiler Collection is a compiler system produced by the GNU Project supporting various programming languages. GCC is a key component of the GNU toolchain....
, using a stand-alone header file collection to make linking against Microsoft DLLs possible. LCC-Win32 is a "free for non-commercial use" C compiler maintained by Jacob Navia (a comp.lang.c regular). Pelles C
Pelles C

Pelles C is a lightweight freeware integrated development environment for Windows and Pocket PC programming in the C built and maintained by Pelle Orinius, featuring:...
 is a free C compiler maintained by Pelle Orinius. Free Pascal
Free Pascal

Free Pascal is a free software, Portability , open source, Pascal programming language and Object Pascal compiler. The 32/64-bit multi-CPU architecture and cross-platform compiler implements the Borland Pascal programming language dialects as well as some MacPascal constructs, and is available for...
 is a GPL Object Pascal
Object Pascal

Object Pascal refers to a branch of Object-oriented programming derivatives of Pascal , mostly known as the primary programming language of CodeGear Delphi....
 compiler capable of writing software based on the Windows API. MASM32
MASM32

MASM32 is a set of 32-bit Assembly language#Assembler development tools and libraries for Microsoft Windows containing Microsoft's MASM assembler and linker....
 is a mature project to support the Windows API utilizing the 32 bit Microsoft assembler with custom made or converted headers and libraries from the Platform SDK.

Windows specific compiler support is also required for the Structured Exception Handling
Exception handling

Exception handling is a programming language construct or computer hardware mechanism designed to handle the occurrence of exceptions - special conditions that change the normal flow of execution....
 feature (SEH). This system serves a dual purpose: it provides a substrate upon which language-specific exception handling 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 itself will be dealt with by the default backstop handler which pops up the Windows common crash dialog.

Microsoft allowed for Visual Basic developers to harness the Windows API directly through the Declare statement. Below is an example of API implementation in Visual Basic
Visual Basic

'Visual Basic' is the third-generation programming language event-driven programming and integrated integrated development environment from Microsoft for its Component Object Model programming model....
: (this example calls the ReleaseCapture and SendMessage API's and causes a command button named "Command1" to be able to be moved around on the form by the user)

Private Const WM_NCLBUTTONDOWN As Long = &HA1& Private Const HTCAPTION As Long = 2& Private Declare Function ReleaseCapture Lib "user32" As Long Private Declare Function SendMessage Lib "user32" Alias "SendMessageA" _ (ByVal hWnd&, ByVal wMsg&, wParam As Any, lParam As Any) As Long

Private Sub Command1_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single) Call ReleaseCapture Call SendMessage(Command1.hWnd, WM_NCLBUTTONDOWN, ByVal HTCAPTION, ByVal 0&) End Sub

See also

  • .NET Framework
    .NET Framework

    The Microsoft .NET Framework is a software framework that is available with several Microsoft Windows operating systems. It includes a large Library of coded solutions to prevent common programming problems and a virtual machine that manages the execution of programs written specifically for the Software framework....
  • Microsoft Foundation Class Library
    Microsoft Foundation Class Library

    The Microsoft Foundation Class Library is a Library that wrapper portions of the Windows API in C++ Class , including functionality that enables them to use a default application framework....
  • Interix
    Interix

    Interix is the name of an optional, full-featured POSIX and Unix environment subsystem for Microsoft's Windows NT-based operating systems. It is a component of the Microsoft Windows Services for UNIX release 3.0 and 3.5 ....
  • - ECMA
    ECMA

    Ecma or ECMA may refer to one of the following:Ecma is short for*Ecma International , formerly : the European Computer Manufacturers Association , an international standards organization for Information Communication Technology and Consumer Electronics ...
     standard for a subset of the Windows API


External links

  • [news://comp.os.ms-windows.programmer.win32 Advanced Win32 api newsgroup]
  • [news://fr.comp.os.ms-windows.programmation French Win32 api newsgroup]