A proof-of-concept Windows Control Panel Applet (.cpl) written in Rust, built without any helper libraries — just the windows crate and the raw Win32 CPL interface.
This was a learning exercise to answer the question: what does it actually take to implement a Windows Control Panel applet in Rust from scratch?
It covers:
- Building a
cdylibthatcontrol.execan load as a.cplfile - Implementing the
CPlAppletexported entry point and handling CPL messages - Embedding Windows resources (icon, string table) using
winresand a.rcfile
A .cpl file is a renamed DLL that exports a single function, CPlApplet. Windows' control.exe loads it and drives it via message passing:
| Message | Purpose |
|---|---|
CPL_INIT |
Applet loaded; return nonzero to signal success |
CPL_GETCOUNT |
Return the number of applets this DLL provides |
CPL_INQUIRE |
Fill a CPLINFO struct with icon/name/description resource IDs |
CPL_DBLCLK |
User double-clicked the applet |
CPL_STOP / CPL_EXIT |
Control Panel is closing |
Requires a Windows target and the MSVC toolchain:
cargo build --target x86_64-pc-windows-msvc
Rename the output .dll to .cpl and drop it into C:\Windows\System32, or invoke it directly:
control.exe path\to\rust_cpl.cpl