Skip to content

Functions Windows

Paul Squires edited this page Nov 8, 2026 · 2 revisions

Home › Function Finder › Windows programming

Windows programming

The functions to build Win32 programs with windows, dialogs and common controls; draw with GDI+ and Direct2D; host COM and WebView2, grouped by what you want to do. The From column says what a program needs before it can call one:

  • sys/win: #import "sys/win", then using win to call it by its bare name.
  • sys/win/<Name>: #import "sys/win/<Name>", then using <Name> to call it by its bare name.

Jump to: Start a Windows program · Measure, move and style windows · Add controls · Show file, folder and print dialogs · Read system information, folders, text and the clipboard · Use fonts, colours and bitmaps · Edit rich text · Draw with GDI+ · Draw with Direct2D and DirectWrite · Call COM objects and use variants · Show web pages in a window

Start a Windows program

Function What it does From
Program basics Reads the command line, shows message boxes, pumps messages and explains Windows errors. sys/win
CWindow Creates a main window, adds controls to it and runs its message loop, scaled for DPI. sys/win/gui
CDialog Creates dialog boxes in memory, fills them with controls and shows them modal or modeless. sys/win/gui
gui macros and helpers Extracts control ids, notification codes and pointers from window-message parameters. sys/win/gui

Measure, move and style windows

Function What it does From
Window text and styles Reads and sets a window's text, class, styles and icon, and redraws windows. sys/win
Window size and position Reads and sets a window's position and size in pixels, and centres windows and controls. sys/win
Finding windows Finds a control's form, top-level windows, controls by id, and the windows of a process. sys/win
Dark mode Gives windows a dark title bar and rounded corners, and reads the light or dark setting. sys/win
Display, screen and DPI Measures the desktop, the screen, the work area and monitors, and scales values for DPI. sys/win
Units Converts between pixels, points, twips, HiMetric units, DIPs and dialog units. sys/win

Add controls

Function What it does From
CTabPage Creates a window that serves as one page of a tab control. sys/win/gui
CXpButton Creates a push button that draws itself, with images, toggle behaviour and custom colours. sys/win/gui
CMaskedEdit Creates an edit control that accepts input only in a set shape, such as a phone number. sys/win/gui
Button Checks, clicks and labels push buttons, check boxes, radio buttons and split buttons. sys/win/gui
Label Sets and reads the text, icon, bitmap, cursor or metafile of a static control. sys/win/gui
Edit Reads, changes, selects and formats the text of single-line and multiline edit controls. sys/win/gui
Combo Adds, finds, selects and reads the items of a combo box, and sets its list and edit box. sys/win/gui
CBEx Inserts, reads and changes the items of a ComboBoxEx control, a combo box with images. sys/win/gui
ListBox Adds, finds, selects and reads the items of a list box control. sys/win/gui
ListView Adds columns and rows to a list view and reads, selects, sorts and groups its items. sys/win/gui
TreeView Adds, finds, expands, selects and styles the items of a tree view control. sys/win/gui
Header Adds, reads, sizes and reorders the columns of a header control. sys/win/gui
TabCtl Adds, selects, renames and removes the tabs of a tab control, and manages its tab pages. sys/win/gui
ToolBar Adds, changes and queries the buttons of a toolbar control and the images they show. sys/win/gui
Rebar Inserts, moves, sizes and queries the bands of a rebar, the container for toolbars. sys/win/gui
Menu Builds menu bars, drop-down and shortcut menus, and reads and changes their items. sys/win/gui
StatusBar Divides a status bar into parts and sets and reads their text, icons and tooltips. sys/win/gui
ToolTip Creates tooltips for controls and windows and sets their text, timing, colours and place. sys/win/gui
ProgBar Sets the range, position, step, colours and state of a progress bar control. sys/win/gui
TrackBar Reads and sets a trackbar's position, range, tick marks, selection and buddy windows. sys/win/gui
UpDown Reads and sets an up-down control's position, range, base, buddy window and acceleration. sys/win/gui
Pager Sets what a pager control scrolls, and reads and sets its position, buttons and colours. sys/win/gui
MonthCal Reads and sets the selected date, range, today and colours of a month calendar control. sys/win/gui
DTP Reads and sets the date and time, range, format and drop-down calendar of a date picker. sys/win/gui
Animate Opens, plays, stops and closes silent AVI clips in an animation control. sys/win/gui
HotKey Reads and sets the key combination in a hot key control, and the combinations it refuses. sys/win/gui
IPAddress Reads, sets and clears the address in an IP address control, and limits its four fields. sys/win/gui
ScrollBar Shows, hides, enables and positions a scroll bar control, and reads and sets its range. sys/win/gui
SysLink Measures a SysLink control, reads and sets its links, and finds the link at a point. sys/win/gui

Show file, folder and print dialogs

Function What it does From
Common dialogs Shows the open, save, folder and colour dialogs, and opens Control Panel applets. sys/win
CPrint Chooses a printer, measures its page, reads and changes its settings, and prints. sys/win/gui
File dialogs Shows the Windows Open and Save dialogs and reads the files the user picked. sys/win/gui
CIFileDialogCustomize Adds check boxes, lists, buttons and other controls to an open or save dialog. sys/win/gui
File dialog events Handles the events of an open or save dialog and of the controls added to it. sys/win/gui
CExplorerBrowser Hosts a Windows Explorer folder view in your window and reports where the user navigates. sys/win/gui

Read system information, folders, text and the clipboard

Function What it does From
Windows version and system Reports the Windows version, build, edition and bitness, and the version of any file. sys/win
System folders Returns the paths of the Windows, system and temporary folders and of known folders. sys/win
Clipboard Puts text and other data on the clipboard, reads it back and empties the clipboard. sys/win
Paths and files Splits paths into folder, name and extension, and detects UTF-16 and UTF-8 text. sys/win
Resources Reads raw data embedded in a program's resources into a string or out to a file. sys/win
Internet Reads the connection state, combines and cleans URLs, and finds browsers and mail. sys/win
Strings Converts case by locale, translates between code pages, formats sizes and splits fields. sys/win

Use fonts, colours and bitmaps

Function What it does From
Fonts Creates fonts, reads the fonts Windows uses and changes the font of a window or control. sys/win
Bitmaps Creates, loads, saves and draws bitmaps, captures the screen and saves icons. sys/win
Colours Names the web colours twice: as RGB_* values for GDI and as ARGB_* values for GDI+. sys/win
CMemBmp Creates an off-screen bitmap to draw on with GDI or GDI+, then save, print or display. sys/win/gui
CGraphCtx Creates a graphic control: a child window that keeps and repaints what you draw on it. sys/win/gui

Edit rich text

Function What it does From
CRichEditCtx Creates a rich edit control in a CWindow and reads and sets its options and formatting. sys/win/richedit
CRichEditCtx-Editing Selects, finds, inserts and replaces text in a rich edit control, and undoes edits. sys/win/richedit
CRichEditCtx-Document Loads, saves and formats rich edit text, and drives its Text Object Model document. sys/win/richedit
RichEdit Sends rich edit messages to a control by its handle: text, selection, formatting and RTF. sys/win/richedit
CTextFont2 Reads and sets the character formatting of rich edit text: font, size, colour and effects. sys/win/richedit
CTextPara2 Reads and sets paragraph formatting in rich edit text: indents, spacing, tabs and lists. sys/win/richedit
CTextRange2 Reads, edits, searches and formats a span of rich edit text through the Text Object Model. sys/win/richedit
CTextSelection2 Reads and changes the selection of a rich edit control through the Text Object Model. sys/win/richedit
CTextRow Inserts table rows into rich edit text and reads and changes row and cell properties. sys/win/richedit
CTextStory Reads and replaces the text of a rich edit story and gives ranges over it. sys/win/richedit
CRichEditOleCallback Answers a rich edit control's OLE questions, so that pictures and objects can be pasted. sys/win/richedit
Text Object Model Lists the Text Object Model interfaces and constants, and the base of the TOM classes. sys/win/richedit

Draw with GDI+

Function What it does From
CGpGraphics Draws lines, shapes, text and images with GDI+ on a window, a device context or an image. sys/win/gdiplus
CGpPen Draws lines and outlines in GDI+ with a colour or brush, a width, dashes and caps. sys/win/gdiplus
GDI+ brushes Fills shapes and text in GDI+ with a colour, a hatch pattern, an image or a gradient. sys/win/gdiplus
GDI+ line caps Draws arrow heads and shapes of your own at the ends of lines drawn with a GDI+ pen. sys/win/gdiplus
CGpGraphicsPath Builds shapes from lines, curves and text, and walks the points they are made of. sys/win/gdiplus
CGpRegion Combines rectangles and paths into areas for filling, clipping and hit-testing in GDI+. sys/win/gdiplus
CGpMatrix Moves, scales, rotates and shears points with a GDI+ affine transformation matrix. sys/win/gdiplus
GDI+ images Loads, creates, edits and saves images with GDI+: bitmaps, metafiles and cached bitmaps. sys/win/gdiplus
CGpImageAttributes Adjusts the colours of an image as it is drawn: colour matrices, gamma, keys, remapping. sys/win/gdiplus
GDI+ effects Blurs, sharpens, tints and corrects the colours of bitmaps with the GDI+ effect classes. sys/win/gdiplus
GDI+ fonts Creates GDI+ fonts and font families and lists the fonts installed or loaded from files. sys/win/gdiplus
CGpStringFormat Sets how GDI+ lays out text in a rectangle: alignment, wrapping, trimming and tab stops. sys/win/gdiplus
GDI+ procedures and types Starts GDI+, builds colours and rectangles, and converts, saves and prints images. sys/win/gdiplus

Draw with Direct2D and DirectWrite

Function What it does From
CD2D1Factory Creates the Direct2D factory that makes render targets, geometries and stroke styles. sys/win/direct2d
Direct2D stroke styles and multithreading Holds Direct2D stroke styles, reads back their settings and locks a multithreaded factory. sys/win/direct2d
CID2D1RenderTarget Draws shapes, bitmaps and text with Direct2D and creates the brushes and bitmaps it uses. sys/win/direct2d
Direct2D render targets Draws into windows, device contexts and bitmaps, and saves and restores drawing state. sys/win/direct2d
Direct2D brushes Paints shapes, lines and text in Direct2D with a colour, a gradient, a bitmap or an image. sys/win/direct2d
Direct2D bitmaps and colour contexts Holds pixel images for a Direct2D render target, and the colour profiles they are in. sys/win/direct2d
CID2D1Geometry Measures, hit-tests and reshapes Direct2D geometries; the base class of every shape. sys/win/direct2d
Direct2D geometries Builds Direct2D shapes from rectangles, ellipses, lines, curves and arcs. sys/win/direct2d
Direct2D helpers Builds the points, rectangles, colours, matrices and property records Direct2D calls take. sys/win/direct2d
Direct2D interfaces and types Lists the Direct2D interfaces, structures and enumerations that sys/win/direct2d declares. sys/win/direct2d
DirectWrite interfaces and types Lists the DirectWrite interfaces, enumerations and structures of sys/win/direct2d. sys/win/direct2d
DXGI interfaces and types Lists the DXGI interfaces, enumerations and structures of sys/win/direct2d. sys/win/direct2d
WIC interfaces and types Lists the WIC interfaces, enumerations and structures of sys/win/direct2d. sys/win/direct2d

Call COM objects and use variants

Function What it does From
DVARIANT Holds a COM VARIANT and converts it to and from tiko numbers, strings, dates and arrays. sys/win/com
DSafeArray Holds a COM SAFEARRAY and destroys it, with all its elements, when it goes out of scope. sys/win/com
BSTRING Wraps a COM BSTR string and frees it when the variable goes out of scope. sys/win/com
CInt96 Stores a 96-bit signed integer in a COM DECIMAL and does arithmetic on it. sys/win/com
CDispInvoke Calls the methods and properties of a COM Automation object by name. sys/win/com
COM procedures Creates COM objects and handles GUIDs, reference counts, event connections and variants. sys/win/com

Show web pages in a window

Function What it does From
CWebView2 Hosts a Microsoft Edge browser in a window and drives it from tiko code. sys/win/webview2
WebView2 event handlers Implements the WebView2 callback interfaces as classes to extend, one per event or result. sys/win/webview2
WebView2 interfaces and types Lists the WebView2 interfaces, enumerations and structures that sys/win/webview2 declares. sys/win/webview2

See Also


Home · Function Finder · Keyword Index

Clone this wiki locally