delphiwindows-7windows-screensaverwm-syscommand

Delphi code to turn on screen saver doesn't work in Windows 7


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?


Solution

  • 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?)