如何以编程方式设置 Windows 7 壁纸幻灯片?
设置普通壁纸
[DllImport("user32.dll", CharSet = CharSet.Auto)]
private static extern Int32 SystemParametersInfo(UInt32 uiAction, UInt32 uiParam, String pvParam, UInt32 fWinIni);
private static UInt32 SPI_SETDESKWALLPAPER = 20;
private static UInt32 SPIF_UPDATEINIFILE = 0x1;
public void SetImage(string filename)
{
SystemParametersInfo(SPI_SETDESKWALLPAPER, 0, filename, SPIF_UPDATEINIFILE);
}
到目前为止我发现了什么:
幻灯片中有一个ini文件
C:\Users\CurrentUser\AppData\Roaming\Microsoft\Windows\Themes\
在幻灯片放映期间,壁纸必须位于以下文件夹中:
C:\Users\CurrentUser\AppData\Roaming\Microsoft\Windows\Themes\TranscodedWallpaper.jpg
(在幻灯片放映期间,文件会自动更改)