win32 6.0.0
win32: ^6.0.0 copied to clipboard
Call common Windows APIs directly from Dart using FFI.
Examples #
This package includes a comprehensive set of examples in the examples directory, demonstrating practical, idiomatic use of Windows APIs from Dart.
What you will find #
Across the examples, you will see how to:
- Invoke C-style Win32 APIs, including struct layout, pointer management, and lifetime control
- Build classic Win32 desktop applications using
user32,gdi32, and common dialogs - Register and use native callback functions safely from Dart
- Create and consume COM objects via both
IUnknownandIDispatch - Integrate low-level Windows APIs into Flutter desktop applications
For real-world usage beyond these samples, explore packages on that depend on package:win32.
Windows system APIs (kernel32) #
Examples focused on core system services such as processes, modules, files, pipes, and the registry.
| Example | Description |
|---|---|
| manifest | App manifests for compiled executables |
| service_manager_cli | Managing Windows services |
| credentials.dart | Writing and reading credentials from the store |
| dump.dart | Enumerating DLL exports using debugger APIs |
| dynamic_load.dart | Loading DLLs and resolving symbols at runtime |
| fileinfo.dart | Querying file metadata with GetFileAttributesEx |
| filever.dart | Reading version information from file resources |
| modules.dart | Enumerating loaded modules |
| pipe.dart | Named pipes and IPC |
| registry.dart | Querying and enumerating registry keys |
| vt.dart | Virtual terminal (ANSI) sequences |
| wsl.dart | Accessing WSL instance information |
Accessing local hardware and devices #
Examples that interact directly with hardware, drivers, and device subsystems.
| Example | Description |
|---|---|
| bluetooth.dart | Enumerating Bluetooth devices |
| bluetoothle.dart | Enumerating Bluetooth LE (Low Energy) devices |
| devices.dart | Listing disk devices via volume APIs |
| diskinfo.dart | Low-level device operations with DeviceIoControl |
| gamepad.dart | Detecting connected game controllers |
| midi.dart | MIDI playback using MCI |
| monitor.dart | Querying monitor capabilities (DDC/CI) |
| play_sound.dart | Playing WAV audio with PlaySound |
| printer_list.dart | Enumerating installed printers |
| printer_raw.dart | Sending RAW data directly to printers |
| serial.dart | Serial port enumeration and configuration |
| setupapi.dart | Device interface discovery via SetupAPI |
| speech.dart | Text-to-speech via Windows Speech APIs |
| sysinfo.dart | System information from native APIs |
| wasapi.dart | Audio generation with WASAPI |
Windows shell manipulation (shell32) #
Examples that integrate with the Windows shell and user environment.
| Example | Description |
|---|---|
| system_tray_icon | Adding an icon to the system tray |
| knownfolder.dart | Accessing known user folders |
| magnifier.dart | Screen magnification using the Magnification API |
| recycle_bin.dart | Querying and modifying the recycle bin |
| screenshot.dart | Capturing screenshots of all displays |
| shortcut.dart | Creating .lnk shell shortcuts |
| wallpaper.dart | Querying wallpaper and background settings |
Win32-style UI development (user32, gdi32, commdlg32) #
Classic desktop UI examples demonstrating message loops, painting, dialogs, and input handling.
| Example | Description |
|---|---|
| dartnote | Lightweight Notepad-style text editor |
| snake | Snake game using GDI rendering |
| task_dialog | Modern task dialogs |
| tetris | Tetris game using GDI rendering |
| usb_drive_monitor | Monitoring USB insertion and removal events |
| hello.dart | Canonical Win32 “Hello, world” |
| msgbox.dart | Displaying a message box from the console |
| commdlg.dart | Color chooser common dialog |
| customtitlebar.dart | Owner-drawn title bar regions |
| customwin.dart | Non-rectangular window rendering |
| dialogbox.dart | Custom dialogs defined entirely in code |
| dialogshow.dart | File picker dialogs via COM |
| paint.dart | Basic painting and window sizing |
| scroll.dart | Horizontal and vertical scrolling |
| sendinput.dart | Synthesizing keyboard and mouse input |
| window.dart | Enumerating and manipulating windows |
COM APIs #
Examples demonstrating COM fundamentals, automation, and system components.
| Example | Description |
|---|---|
| com_interop | Accessing .NET components through COM |
| com_context.dart | COM apartments and Dart isolates |
| com_demo.dart | Object creation, casting, and invocation |
| dispatcher.dart | Automation via Dispatcher |
| guid.dart | Creating and manipulating GUIDs |
| uiautomation.dart | Windows UI Automation APIs |
| winhttp.dart | HTTP requests using WinHTTP |
| wmi_perf.dart | Performance counters via WMI |
| wmi_wql.dart | Querying WMI with WQL |
Flutter integration #
Examples that bridge low-level Win32 APIs into Flutter desktop applications.
| Example | Description |
|---|---|
| explorer | Retrieving volumes on the computer |
| task_manager | Enumerating and managing running processes |
Miscellaneous #
| Example | Description |
|---|---|
| events.dart | Querying Windows event channels |




