A simple program to lock your workstation and put all monitors into powersave mode.
You can download the compiled executable here.
Doesn't NirCmd do this?
Yes, with a very simple script:
lockws
monitor off
Because NirCmd hangs after putting my monitor to sleep, leaving an army of zombie processes over time. This annoys me more than it should.
Interestingly enough, the Windows SendMessage API is not returning on my system
when called with HWND_BROADCAST
or HWND_TOPMOST
and the monitor power
command. So, really, it is probably not NirCmd's fault.
Rather than figure out which program/driver/whatever is causing that problem, I just decided to write my own that doesn't broadcast the monitor off message to everyone. Instead, I create a dummy form, and send the message to that.
Windows intercepts the message and does its thing, and we're golden!