From Chessprogramming wiki
Jump to: navigation, search

Home * Software * Windows

Windows Server 2012 Logo [1]

a series of 32-bit and 64-bit operating systems by Microsoft for x86 and x86-64 PC's, as well as Windows CE for embedded systems and the mobile operating system Windows Mobile. Its development started in the early 80s as a graphical user interface for 16-bit MS-DOS operating system, with the ability to perform cooperative multitasking while processing an event loop.


Windowa211 286.jpg
Windows 1.0, 1985 [2] Windows/286 2.11, 1987 [3]
Windowsnt40 screenshot.jpg
Windows NT 4.0 [4] Windows 10 Task View [5]

Chess Engines

Most current chess engines are suited to run under Windows, a few with its own proprietary user interface, but most common as console application and child process of an external chess GUI communicating via redirected standard streams [6] using protocols like the Chess Engine Communication Protocol (WinBoard) and/or the Universal Chess Interface (UCI).

Windows Chess GUIs

Arena [7] Deep Sjeng under ChessPartner [8]
DeepFritz14d 1.jpg
Deep Fritz 14 GUI [9] Deep Rybka 4 Aquarium [10]



Microsoft Word
Microsoft Excel
Microsoft PowerPoint



Taipei by David Norris
Ziggurat by David Norris

Remote Desktop

Remote Desktop Services, MSDN


Covers integrated development environments (IDE), Software development kit (SDK), Application programming interface (API), programming languages, compiler and tools.


Visual Studio 2010, MSDN home


Common Language Runtime Overview, MSDN
Windows Communication Foundation from Wikipedia




Input and Output


Interprocess Communications

Dynamic Linking

Dynamic-Link Libraries, MSDN
The End of DLL Hell, MSDN


C programmers were faced with some new paradigms from early 16-bit Windows API, not to mention the fact that a lot of C standard library functions were hard and error-prone to use, or even taboo [11] . Charles Petzold: "The original hello world program 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." [12] .

WinMain and the Message loop

Windows programs are event-driven, have no usual main, but WinMain to enter a event loop [13] , where DispatchMessage transfers messages to a callback procedure associated with the window the message refers to, i.e. for keyboard events one window which owns the keyboard focus. To make Windows applications work flawlessly, keeping its windows up to date, that is processing paint messages, the I/O bound GUI thread needs to be run in the message loop, to react on messages best within 20 ms. In early 16-bit Windows, DispatchMessage implemented cooperative multitasking - but one application being uncooperative could made the whole system hang.

int APIENTRY WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow)
   MSG msg;
   wc.lpfnWndProc = (WNDPROC) MyWndProc; // associate a Window procedure for this "class" of windows
   if (!RegisterClass(&wc)) // register window class
       return FALSE;
   hwnd = CreateWindow(...);
   ShowWindow(hwnd, SW_SHOW);
   while(GetMessage(&msg, NULL, 0, 0) > 0)
   return msg.wParam;

Window Procedure

The callback or Window procedure is called from the above message loop.

    HWND hwnd,        // handle to window
    UINT uMsg,        // message identifier
    WPARAM wParam,    // first message parameter
    LPARAM lParam)    // second message parameter
    HDC hdc;
    switch (uMsg)
        case WM_CREATE:    // Initialize the window
            return 0;
        case WM_PAINT:
            hdc = BeginPaint(hwnd, &ps);
            TextOut(hdc, 0, 0, "Hello, Windows!", 15);
            EndPaint(hwnd, &ps);
            return 0;
        case WM_DESTROY:   // Clean up window-specific data objects
            return 0;
        case WM_CHAR:      // Process Keyboard character events
            return 0;
        case WM_MOUSEMOVE: // Process mouse move events
            return 0;
        // Process other messages
            return DefWindowProc(hwnd, uMsg, wParam, lParam);
    return 0;

Standard C Library


Microsoft's proprietary C++ Foundation Classes wrapped the handle based Windows API and hides much of its complexity. Still one of the early class libs, it has a lot of ugly macros, i.e. for message maps. Borland's counter part was the Object Windows Library.

Command-Line Applications

Applies for most UCI and/or Chess Engine Communication Protocol (WinBoard) compatible chess engines, relying on an external GUI.

Class Libs

MFC Reference, MSDN


Visual C++ Tutorials, Library, and More on MSDN
MinGW - Minimalist GNU for Windows
Cygwin Information and Installation
Intel® Compilers
Intel(R) C++ Compiler User and Reference Guides covers Intrinsics » x86, x86-64, MMX, SSE2, SSSE3, SSE4, AVX

Calling Conventions

Agner Fog describes x86 and x86-64 calling conventions for different C++ compilers and operating systems, covering 32-bit and 64-bit Windows [14] :

The document contains details about data representation, function calling conventions, register usage conventions, name mangling schemes, etc. for many different C++ compilers and operating systems. Discusses compatibilities and incompatibilities between different C++ compilers. Includes information that is not covered by the official Application Binary Interface standards (ABI's). The information provided here is based on my own research and therefore descriptive rather than normative. Intended as a source of reference for programmers who want to make function libraries compatible with multiple compilers or operating systems and for makers of compilers and other development tools who want their tools to be compatible with existing tools.

Other Languages

See also


Forum Posts

1995 ...

2000 ...

2010 ...

2015 ...

Further Links


Up one Level