labelsvur.blogg.se

Powershell get monitor model
Powershell get monitor model




powershell get monitor model

PROC LockWorkStation = (PROC) GetProcAddress(hinstLib, "LockWorkStation") HINSTANCE hinstLib = LoadLibrary("user32") 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).

  • And set the state of the display in lParam to either 1 (lower power) or 2 (shut off) - though only the latter has ever worked for me.
  • powershell get monitor model

  • Set wParam to 0xF170 (SC_MONITORPOWER).
  • It's so easy to trigger the monitor to sleep using the Win32 API WM_SYSCOMMAND:

    powershell get monitor model

    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.






    Powershell get monitor model