问题
How to install (register) screensaver programmatically?
回答1:
AFAIk there are two ways:
- Permanent registration by copying it to a location that windows searches, such as
System32. But don't hardcode "C:\Windows\System32". You need to query the system to find out where the system directory is. - Calling the
Installaction on the.scrfile, which results in temporary activation. But the screensaver will disappear once another has been selected and the dialog restarted.
But this is from Win95 times, so it's possibly outdated.
I see three ways to call install:
- ShellExecute(Ex) using the
installverb - Call
rundll32.exe desk.cpl,InstallScreenSaver %l - Load
desk.cplas library(LoadLibrary or by declaring an import forInstallScreenSaver) and then call theInstallScreenSavermethod with your own path as parameter.
回答2:
A walkthrough here -
http://www.desktopmanagementsoftware.org/creating-an-msi-package-for-a-screensaver
来源:https://stackoverflow.com/questions/5282456/how-to-install-screensaver-programmatically