111,126
社区成员
发帖
与我相关
我的任务
分享// 将本程序设置为屏保
//const uint SPI_SETSCREENSAVERRUNNING = 0x0061;
// 屏保状态
const uint SPI_SETSCREENSAVEACTIVE = 0x0011;
// 获取屏幕壁纸地址
const uint SPI_GETDESKWALLPAPER = 0x0073;
[DllImport("user32.dll", CharSet = CharSet.Auto, SetLastError = true)]
static extern bool SystemParametersInfo(uint uAction, uint uParam, StringBuilder lpvParam, uint init);
//static extern bool SystemParametersInfo(uint uAction, uint uParam, uint lpvParam, uint init);
/*
* 设置壁纸
* private const int SPI_SETDESKWALLPAPER = 20
* SystemParametersInfo(SPI_SETDESKWALLPAPER, 0, filename, 1);
*/public static void SetScreener()
{
bool ok;
StringBuilder str = new StringBuilder(100);
ok = SystemParametersInfo(SPI_SETSCREENSAVEACTIVE, 1, str, 0);
}
public static void CancelScreener()
{
bool ok;
StringBuilder str = new StringBuilder(100);
ok = SystemParametersInfo(SPI_SETSCREENSAVEACTIVE, 0, str, 0);
}const uint SPI_SETSCREENSAVEACTIVE = 0x0011;readonly uint SPI_SETSCREENSAVEACTIVE = 0x0011;