WiX Tricks for Screen Savers
I've been migrating my installers over to WiX. My only complaint with the WiX toolkit is that there's no bootstrapper included. This is important for installing any pre-requisites before passing control over to Windows Installer. Hopefully this will come after WiX 3.0 is released. For now, I've rolled my own bootstrapper to install .NET 2.0 if needed.
A couple of tips for screen savers. You can bring up the Windows screen saver settings using the following custom action. This is the same command that is launched when you right-click a screen saver (.scr) file and pick Install:
Sequence this in InstallExecuteSequence after InstallFinalize:
You can also add a shortcut to your Program Files folder to configure the screen saver. This is really helpful for people who aren't sure how to get to the screen saver dialog from Control Panel or right-clicking the Desktop:
Unlike a shortcut to a file that you install you need to specify the Target. The example above assumes that ProgramMenuDir is the Id of your Start Menu folder. The shortcut should be in a Directory but not as a child of a File node.
Updated 2020-05-26 20:22:
It looks like something changed in Windows 10, around build 1903, that stops this from working on 64-bit systems. The screensaver will preview OK but does not start as expected (system screensavers start OK, so it's not some sort of power management problem). I could reproduce this on one box running 1909 but not another so maybe there is something else going on. The snippets above will run rundll32.exe from the SysWOW64 folder and at some point this seems to have stopped working. Changing to [System64Folder]rundll32.exe launches the System32 version which then causes the screensaver to load normally. If your screensaver is 32-bit and installed to SysWOW64 then you need a command that looks like this on a 64-bit system: [System64Folder]rundll32.exe desk.cpl,InstallScreenSaver [SystemFolder]the.scr
Related Posts
- Installation: Early and Often
- Catfood Software Support
- Video timeout on XP and Vista (power management)
- Reboot computer in C# / .NET
- XamlParseException and 256x256 icons
(Published to the Fediverse as: WiX Tricks for Screen Savers #code #c# How to run the screen saver install dialog from Windows Installer XML or WiX and add a program menu shortcut. )
Comments
Yeah, the lack of a bootstrapper has been a problem for a while. I've had a design ready for a long time, just haven't had the resources to devote to it. We're changing that in WiX v3.5. Burn (our bootstrapper) will be delivered then.
Add Comment
All comments are moderated. Your email address is used to display a Gravatar and optionally for notification of new comments and to sign up for the newsletter.