This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
powershell (Add-Type '[DllImport(\"user32.dll\")]^public static extern int PostMessage(int hWnd, int hMsg, int wParam, int lParam);' -Name a -Pas)::PostMessage(-1,0x0112,0xF170,2) |
Well, if anyone wishes to have that code, here it is:
powershell (Add-Type '[DllImport(\"user32.dll\")]^public static extern int PostMessage(int hWnd, int hMsg, int wParam, int lParam);' -Name a -Pas)::PostMessage(-1,0x0112,0xF170,2)
I found that using SendMessage
resulted in the command to stall because it was waiting for a response.
@Ma-XX-oN Thanks. I've updated the gist with your code.
is there a way to tell it to which of the multimonitor setup to turn off ?
Not that I'm aware of. AFAIK, it just turns off all of them.
Very nice. I dropped it into my scripts folder and placed a shortcut on my desktop. I already had something similar on Linux and I am glad to see someone already did this for Windows.
Great script! Just a note, .NET 3.5 is required on Windows 11 for this to function. Otherwise you'd get mscoree.dll
error.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
@Ma-XX-oN This piece of code originally came from stackoverflow. I copied it years back and I can't quite remember the source post. Anyway, it "just did the job" for me back then and I didn't give it much thought. If someone uses this, it is probably a good idea to take note of your comment.