桌面、屏保等设置均为操作注册表
1、设置桌面面背景
prototype SetDesktop(STRING);
function SetDesktop(szPath)
STRING szKey;
begin
szKey = "\\Control Panel\\Desktop";
RegDBSetDefaultRoot(HKEY_CURRENT_USER);
if (RegDBCreateKeyEx (szKey, "Wallpaper") >= 0) then
if RegDBSetKeyValueEx (szKey, "Wallpaper", REGDB_STRING, szPath, -1) < 0 then
//WallpaperStyle 0default ,1平铺,2拉伸
return -1;
endif;
endif;
szKey = "\\Software\\Microsoft\\Internet Explorer\\Desktop\\General";
if RegDBSetKeyValueEx (szKey, "Wallpaper", REGDB_STRING, szPath, -1) < 0 then
return -1;
endif;
if RegDBSetKeyValueEx (szKey, "BackupWallpaper", REGDB_STRING, szPath, -1) < 0 then
return -1;
endif;
end;
2、设置屏幕保护
prototype SetScreenSavers(STRING);
function SetScreenSavers(szPath)
STRING szKey;
begin
szKey = "\\Control Panel\\Desktop";
RegDBSetDefaultRoot(HKEY_CURRENT_USER);
if (RegDBCreateKeyEx (szKey, "SCRNSAVE.EXE") >= 0) then
if RegDBSetKeyValueEx (szKey, "SCRNSAVE.EXE", REGDB_STRING, szPath, -1) < 0 then
return -1;
endif;
endif;
if (RegDBCreateKeyEx (szKey, "ScreenSaverIsSecure") >= 0) then
if RegDBSetKeyValueEx (szKey, "ScreenSaverIsSecure", REGDB_STRING, "1", -1) < 0 then
return -1;
endif;
endif;
end;
3、设置开机自动运行程序
prototype SetAutoRunExecute(STRING);
function SetAutoRunExecute(szPath)
STRING szKey;
STRING szName;
begin
szKey = "\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Run";
szName = "GraspAssistant";
RegDBSetDefaultRoot ( HKEY_LOCAL_MACHINE );
if (RegDBCreateKeyEx (szKey, szName) >= 0) then
if RegDBSetKeyValueEx (szKey, szName, REGDB_STRING, szPath, -1) < 0 then
return -1;
endif;
endif;
end;