![Windows 10 monitor not turning off](https://cdn-ak.f.st-hatena.com/images/fotolife/g/greathigh-power/20200126/20200126194015.jpg)
In fact, I recall writing an Assembly version that was even simpler, circa 1998. Return SendMessage(GetDesktopWindow(), WM_SYSCOMMAND, SC_MONITORPOWER, 2) or return SendMessage(GetDesktopWindow(), WM_SYSCOMMAND, SC_SCREENSAVE, 0) If (LockWorkStation != NULL) (LockWorkStation)() PROC LockWorkStation = (PROC) GetProcAddress(hinstLib, "LockWorkStation")
![windows 10 monitor not turning off windows 10 monitor not turning off](https://winaero.com/blog/wp-content/uploads/2015/04/Windows-10-action-center.png)
HINSTANCE hinstLib = LoadLibrary("user32")
![windows 10 monitor not turning off windows 10 monitor not turning off](https://1.bp.blogspot.com/-EDa1YNLBgRo/Wq4c4KtXKVI/AAAAAAAADlc/Dl1z059iapU673SAZ2gjsiJxDq0c3DCFACLcBGAs/s1600/How-to-disable-turn-off-touch-screen-on-windows-10.png)
Int WINAPI WinMain(HINSTANCE hinstCurrent, HINSTANCE hinstPrevious, LPSTR lpszCmdLine, int nCmdShow) In fact I found my old C code, dated 2001, that does this plus locks the workstation from the command line: #define WIN 32_LEAN_AND_MEAN The shortcut can be assigned properties like a shortcut key (hotkey) too: Simply create a new shortcut (all entered in one line): powershell (Add-Type 'public static extern int PostMessage(int h,int m,int w,int l) ' -Name a -Pas)::PostMessage(-1,0x0112,0xF170,2) However, instead of SendMessage, use PostMessage, lest the script get stuck waiting for a reply. The method is based on the idea here - running a PowerShell script from the command line (to avoid PowerShell script security).
![windows 10 monitor not turning off windows 10 monitor not turning off](https://silicophilic.com/wp-content/uploads/2019/12/Touch_Screen.jpg)
Hmmm, seems Windows has never improved, because I recall having this requirement back-in-the-day - haha, that was during my first project ever, when I was involved in some Win32 development. I wanted to turn off my monitor in Windows 10, while listening to music, rather than wait for the Power plan “Turn off the display” timer to kick in.
![Windows 10 monitor not turning off](https://cdn-ak.f.st-hatena.com/images/fotolife/g/greathigh-power/20200126/20200126194015.jpg)