开发者

starting and stopping the screensaver

开发者 https://www.devze.com 2023-01-12 03:08 出处:网络
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:

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);
  开发者_Python百科          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.


SPI_SETSCREENSAVEACTIVE does not actually start/stop the screensaver. It is meant for actual screensavers to call to let the OS know that they are running or exiting. To start the screensaver, try sending a WM_SYSCOMMAND/SC_SCREENSAVE message to the GetDesktopWindow() window.

0

精彩评论

暂无评论...
验证码 换一张
取 消