How to install screensaver programmatically?

不打扰是莪最后的温柔 提交于 2019-12-19 09:27:43

问题


How to install (register) screensaver programmatically?


回答1:


AFAIk there are two ways:

  1. 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.
  2. Calling the Install action on the .scr file, 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:

  1. ShellExecute(Ex) using the install verb
  2. Call rundll32.exe desk.cpl,InstallScreenSaver %l
  3. Load desk.cpl as library(LoadLibrary or by declaring an import for InstallScreenSaver) and then call the InstallScreenSaver method 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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!