agentleFS
AkashPriyadarshiiAkashPriyadarshii/cookbook/windows/SKILL.md

windows

Skill0 starsChanged 3 months agoMITView on GitHub

Lessons from building autonomous background daemons on Windows 11. Bug: Calling Shell_NotifyIconW(NIM_ADD, &nid) from a background Rust/console binary failed with 2147500037 (0x80004005 E_FAIL). Crates like tray-icon and tray-item crashed on startup when invoked headless. Fix: Windows Shell Notify APIs require an explicit Win32 message pump running on an STA thread. In raw Win32, call RegisterClassW + a hidden window message pump; in .NET/WinForms, wrap in [STAThread] and ApplicationContext. Check: Run the daemon under a non-interactive/hidden window launcher — tray icon…

5 other projects use a version of this.

Adopted by

Most recently taken up by

The file

We split this skill into the rules it gives an agent

1 rule. 0 are common, 0 are distinctive, and 1 is very specific to this project.

  • 0

    Common

    Most of the 4 edited versions we read keep these.

  • 0

    Distinctive

    This author's own choices. Worth a look.

  • 1

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Very specific:

    Check: Run the daemon under a non-interactive/hidden window launcher — tray icon must register and return success, not E_FAIL.

    line 23

“Common” is measured: kept by at least 6 in 10 of the 4 edited versions of this file we could read. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

Windows Desktop Daemon Lessons

Lessons from building autonomous background daemons on Windows 11.

1. Shell_NotifyIconW fails with 0x80004005 in console processes

Bug: Calling Shell_NotifyIconW(NIM_ADD, &nid) from a background Rust/console binary failed with 2147500037 (0x80004005 E_FAIL). Crates like tray-icon and tray-item crashed on startup when invoked headless.

Fix: Windows Shell Notify APIs require an explicit Win32 message pump running on an STA thread. In raw Win32, call RegisterClassW + a hidden window message pump; in .NET/WinForms, wrap in [STAThread] and ApplicationContext.

Check: Run the daemon under a non-interactive/hidden window launcher — tray icon must register and return success, not E_FAIL.

2. Headless NotifyIcon silently exits without ApplicationContext

Bug: A background tray daemon launched via -WindowStyle Hidden appeared in process list for 2 seconds and exited without an error or Event Viewer entry. Garbage collection swept the tray handle because no main window was open.

Fix: Pass an explicit ApplicationContext to Application.Run(context). Do not rely on parameterless Application.Run() when the process has no visible Form window.

Check: Get-Process <name> 10 seconds after hidden launch must show active PID with stable working set.

3. Task Manager Startup tab ignores HKCU Run without StartupApproved

Bug: Adding an executable to HKCU\Software\Microsoft\Windows\CurrentVersion\Run ran the app on boot, but the app was completely invisible in Windows 11 Task Manager's "Startup apps" tab.

Fix: Task Manager requires a companion entry in HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\StartupApproved\Run with binary value 02 00 00 00 00 00 00 00 00 00 00 00. Update both registry paths during install/setup.

Check: Open Task Manager → Startup apps; verify entry displays with status "Enabled" rather than missing.

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.