再给你一个函数,运行一次就可以关闭屏保(有密码也同样关闭),直至系统重启。
procedure KillScreenSaver;
var
H: THandle; ScreenSaver: Bool;
begin
if SystemParametersInfo(SPI_GETSCREENSAVEACTIVE,0,@ScreenSaver,0) then
if ScreenSaver then
SystemParametersInfo(SPI_SETSCREENSAVEACTIVE,0,NIL,0);
H:=FindWindowEx(0,0,PChar('WindowsScreenSaverClass'),Nil);
if H<>0 then
if SendMessage(H, WM_QUERYENDSESSION,0,0)<>0 then
begin
PostMessage(H, WM_CLOSE,0,0);
Sleep(400);
PostMessage(H, WM_QUIT,0,0);
end;
end;