experchange > windowsxp.* > windowsxp.help_and_support

Ron Hardin (05-14-19, 12:49 PM)
Windows media player apparently, having been used in a format emergency to play a DVD
instead of VLC player, apparently leaves something running that prevents my "turn monitor
off" program from finishing.

$ cat monitoroff.c
#include <windows.h>
main() {
sleep(1);
SendMessage(HWND_BROADCAST, WM_SYSCOMMAND, SC_MONITORPOWER, (LPARAM) 2);
exit(0);
}

It works but hangs instead of exiting.

(Cygwin under XP)
JJ (05-14-19, 10:15 PM)
On Tue, 14 May 2019 06:49:38 -0400, Ron Hardin wrote:
[..]
> }
> It works but hangs instead of exiting.
> (Cygwin under XP)


Shouldn't you use the SC_MONITORPOWER? i.e. send the WM_SYSCOMMAND message
with SC_MONITORPOWER wParam and lParam 0x02 to the desktop process' window
(titled "Program Manager").
JJ (05-14-19, 10:17 PM)
On Tue, 14 May 2019 06:49:38 -0400, Ron Hardin wrote:
[..]
> }
> It works but hangs instead of exiting.
> (Cygwin under XP)


Send it to the the desktop process' window instead (window title "Program
Manager").
Similar Threads