Win32 User Interface API Reference

This section provides documentation for the Windows API functions related to creating and managing the graphical user interface (GUI) for Windows applications.

The Win32 User Interface API encompasses a wide range of functionalities, including window management, message handling, control manipulation, menus, dialog boxes, and more. These APIs are fundamental for developing desktop applications with a rich and interactive user experience.

Key Concepts

Commonly Used Functions

Function Name Description
CreateWindowEx Creates an overlapped, pop-up, or child window.
DefWindowProc Dispatches a message to the default window procedure.
GetMessage Retrieves messages from the calling thread's message queue.
TranslateMessage Translates virtual-key messages into character messages.
DispatchMessage Dispatches a message to a window procedure.
MessageBox Displays a message box with specified text and buttons.
DialogBox Creates a modal dialog box.
InvalidateRect Adds a rectangle to a window's update region.
UpdateWindow Updates a window's client area.
SetFocus Sets the keyboard focus to a specified window.

CreateWindowEx

Creates an overlapped, pop-up, or child window. This is one of the most fundamental functions for creating windows.

HWND CreateWindowEx(
  DWORD     dwExStyle,
  LPCTSTR   lpClassName,
  LPCTSTR   lpWindowName,
  DWORD     dwStyle,
  int       x,
  int       y,
  int       nWidth,
  int       nHeight,
  HWND      hWndParent,
  HMENU     hMenu,
  HINSTANCE hInstance,
  LPVOID    lpParam
);

Parameters:

DefWindowProc

Dispatches a message to the default window procedure. This function is typically called by an application's main message loop when it does not handle a particular message.

LRESULT DefWindowProc(
  HWND   hWnd,
  UINT   uMsg,
  WPARAM wParam,
  LPARAM lParam
);

Parameters:

GetMessage

Retrieves messages from the calling thread's message queue. This is a core part of the message loop.

BOOL GetMessage(
  LPMSG lpMsg,
  HWND  hWnd,
  UINT  wMsgFilterMin,
  UINT  wMsgFilterMax
);

Parameters:

MessageBox

Displays a message box that can contain an application-defined icon, set of buttons, and descriptive text. It's a simple way to communicate with the user.

int MessageBox(
  HWND    hWnd,
  LPCTSTR lpText,
  LPCTSTR lpCaption,
  UINT    uType
);

Parameters:

Refer to the full Win32 API documentation for a comprehensive list of functions and their detailed descriptions.