Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Windows

Perry compiles TypeScript apps for Windows using the Win32 API.

Requirements

  • Windows 10 or later
  • A linker toolchain — either of these two options:

Uses LLVM’s clang + lld-link plus an xwin’d copy of the Microsoft CRT + Windows SDK libraries. No admin rights, no Visual Studio install.

winget install LLVM.LLVM
perry setup windows

perry setup windows downloads ~700 MB (unpacks to ~1.5 GB) at %LOCALAPPDATA%\perry\windows-sdk after prompting you to accept the Microsoft redistributable license. Pass --accept-license to skip the prompt in CI. Partial downloads resume safely on re-run.

Option B — Visual Studio (~8 GB)

If you already have Visual Studio installed, add the C++ workload via the Visual Studio Installer → Modify → check Desktop development with C++. Or install standalone Build Tools:

winget install Microsoft.VisualStudio.2022.BuildTools --override `
  "--quiet --wait --add Microsoft.VisualStudio.Workload.VCTools --includeRecommended"

Both options produce identical binaries — Perry picks Option A when the xwin’d sysroot is present, Option B otherwise. Run perry doctor to see which is active.

Building

perry compile app.ts -o app.exe --target windows

UI Toolkit

Perry maps UI widgets to Win32 controls:

Perry WidgetWin32 Class
TextStatic HWND
ButtonHWND Button
TextFieldEdit HWND
SecureFieldEdit (ES_PASSWORD)
ToggleCheckbox
SliderTrackbar (TRACKBAR_CLASSW)
PickerComboBox
ProgressViewPROGRESS_CLASSW
ImageGDI
VStack/HStackManual layout
ScrollViewWS_VSCROLL
CanvasGDI drawing
Form/SectionGroupBox

Windows-Specific APIs

  • Menu bar: HMENU / SetMenu
  • Dark mode: Windows Registry detection
  • Preferences: Windows Registry
  • Keychain: CredWrite/CredRead/CredDelete (Windows Credential Manager)
  • Notifications: Toast notifications
  • File dialogs: IFileOpenDialog / IFileSaveDialog (COM)
  • Alerts: MessageBoxW
  • Open URL: ShellExecuteW

Next Steps