1

Should have been simple I would have thought. I want to force the PC to go into screen saver mode, and exit it when conditions I am checking in by D2006) app come true. It doesn't seem to work:

    if ScreenSaverExitRequested then
        begin
        SystemParametersInfoResult := SystemParametersInfo(SPI_GETSCREENSAVERRUNNING, 0, @ScreenSaverIsRunning, 0);
        if ScreenSaverIsRunning then
            begin
            SystemParametersInfoResult := SystemParametersInfo(SPI_SETSCREENSAVEACTIVE, UINT(false), nil, SPIF_SENDWININICHANGE);
            end ;
        end ;
....
    if ScreenSaverEntryRequested then
        begin
        SystemParametersInfoResult := SystemParametersInfo (SPI_SETSCREENSAVEACTIVE, 1, nil, SPIF_SENDWININICHANGE) ;
        end ;

SystemParametersInfoResult is returning true in each case. The calls to SystemParametersInfo don't seem to have any effect. If I place the PC in SS mode by using the "Preview" button on the Control Panel Display Properties dialog, executing my code does nothing.

4

1 回答 1

3

SPI_SETSCREENSAVEACTIVE 实际上并不启动/停止屏幕保护程序。它旨在让实际的屏幕保护程序调用以让操作系统知道它们正在运行或退出。要启动屏幕保护程序,请尝试将 WM_SYSCOMMAND/SC_SCREENSAVE 消息发送到 GetDesktopWindow() 窗口。

于 2010-08-20T02:08:44.853 回答