3

I have a Delphi app that places the computer into screensave using

hWnd := GetDesktopWindow ;
SendMessage (hWnd, WM_SYSCOMMAND, SC_SCREENSAVE, 0) ;

This works fine under XP but I find it doesn't work under (embedded) Windows 7.

Any ideas?

rossmcm
  • 5,493
  • 10
  • 55
  • 118
  • 1
    Ahaa. Problem was there was no (Windows) screen saver set up on the embedded machine. I was fooled by the fact that the screen in fact did turn off after a delay, but that appears to be a hardware behaviour of the tablet PC. Both SendMessage (, WM_SYSCOMMAND, SC_SCREENSAVE, 0) ; and SendMessage (
    , WM_SYSCOMMAND, SC_SCREENSAVE, 0) ; seem to return a value of zero.
    – rossmcm Nov 30 '10 at 03:20

2 Answers2

4

It works for me (Windows 7 Home Premium, 64-bit). Have you tried to send the message to another window, such as Handle? (Also, are you sure that you have a screensaver installed?)

Andreas Rejbrand
  • 105,602
  • 8
  • 282
  • 384
0

The SC_SCREENSAVE message tells the target window to execute the screen saver application specified in the [boot] section of the System.ini file. As the o/s is Embedded windows, which is a cut-down version of windows, quiet likely the system.ini file is configured for no screen-saver. Check your system.ini file.

Sean B. Durkin
  • 12,659
  • 1
  • 36
  • 65
  • 1
    I don't think so. `system.ini` is only used as a compatibility relic for 16-bit applications. `system.ini` hasn't been used for real in Windows for quite some time. See http://en.wikipedia.org/wiki/SYSTEM.INI – Andreas Rejbrand Nov 30 '10 at 02:12