Window Management Functions

The Win32 API provides a rich set of functions for managing windows, user interface elements, and handling user input. This section covers core functionalities for creating, manipulating, and interacting with windows.

Core Window Functions

Function Description
CreateWindowEx Creates an overlapped, pop-up, or child window with a wide style.
DestroyWindow Destroys the specified window. The DestroyWindow function posts a WM_DESTROY message to the window to which the specified handle identifies.
ShowWindow Sets the show state of a window.
UpdateWindow Updates the client area of a window that has been interrupted.
GetMessage Retrieves messages from the calling thread's message queue.
DispatchMessage Dispatches a message to a window procedure.

CreateWindowEx

Syntax

HWND CreateWindowExA(
  DWORD     dwExStyle,
  LPCSTR    lpClassName,
  LPCSTR    lpWindowName,
  DWORD     dwStyle,
  int       X,
  int       Y,
  int       nWidth,
  int       nHeight,
  HWND      hWndParent,
  HMENU     hMenu,
  HINSTANCE hInstance,
  LPVOID    lpParam
);

Creates an overlapped, pop-up, or child window with a wide style.

Parameters

Return Value

DestroyWindow

Syntax

BOOL DestroyWindow(
  HWND hWnd
);

Destroys the specified window. The DestroyWindow function posts a WM_DESTROY message to the window to which the specified handle identifies.

Parameters

Return Value

ShowWindow

Syntax

BOOL ShowWindow(
  HWND hWnd,
  int  nCmdShow
);

Sets the show state of a window.

Parameters

Return Value

UpdateWindow

Syntax

BOOL UpdateWindow(
  HWND hWnd
);

Updates the client area of a window that has been interrupted.

Parameters

Return Value

GetMessage

Syntax

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

Retrieves messages from the calling thread's message queue.

Parameters

Return Value

DispatchMessage

Syntax

LRESULT DispatchMessageA(
  const MSG *lpMsg
);

Dispatches a message to a window procedure.

Parameters

Return Value