How Can I Turn Off My Laptop's Display Whenever I Want?
Update: I have moved the .exe download from 4Shared to my own domain (http://www.ldapfilters.com), therefore the download is a one step process now.Update (2026): I revisited this whole topic for 2026 — turns out you no longer need to compile anything or download an .exe at all. PowerShell can do the exact same thing in one line, built into every Windows PC. Read the rewrite here: Turn Off Your Windows Display With One Line of PowerShell (2026 Update).
I recently felt the need to turn off my laptop's monitor on my will, but you know there ain't such a button on almost all laptops. (Not interested in tech stuff? scroll down directly to Download, and get the executeable) So I tried to search around the internet for some utility, sadly speaking I didn't find any such thing. But you know I'm a programmer after all, therefore instead of searching a trust-worthy utility, I sought a do it yourself code example. I found the example here on code project: http://www.codeproject.com/KB/system/display_states.aspx The code needed to turn your monitor off/on is literally a one liner. All you need is one line, and your monitor will be powered off as soon as you run the .exe file. Here's the code friends:
#include <Windows.h>
int main(int argc, char* argv[]) {
SendMessage(HWND_BROADCAST, WM_SYSCOMMAND, SC_MONITORPOWER, (LPARAM) 2);// this c++ code will turn the monitor off
return 0;
}
The good news is Windows handles that part automatically. Whenever we turn off display with this cut throat application of ours, moving mouse or pressing a key will bring the monitor back to life. Although broadcasting another message will fire the display up, but we don't need that I think. Still, here's the code: SendMessage(HWND_BROADCAST, WM_SYSCOMMAND, SC_MONITORPOWER, (LPARAM) 1); Take this piece of code to any C++ IDE of your choice(of course Windows duffer!!!), just compile build and your very own application to turn off the monitor will be ready. Place the executable anywhere you want, create a shortcut on desktop, whenever you'll click it the monitor will go dark. And if you don't wanna do that, just download the ready to run executable of this cut throat advanced bleeding edge top class wonderful awesome @#%$#%&~!^&%$#@+ app that can shut down your PC or Laptop's display/monitor whenever you want here !!!
(2026 note: this download link is over a decade old at this point and I can no longer personally vouch for what's on the other end of it. The 2026 PowerShell rewrite gets you the identical result with one built-in command — nothing to download, compile, or trust.)
Instructions:
- Just place the .exe file anywhere in your system, double clicking it will turn off the monitor you may create a shortcut on desktop, or pin it to task bar for easy access (details below).
- Moving the mouse, or pressing a key on keyboard will turn your system's display back on.
- This utility does not open any network communications port
- This utility does not read/write any kind of files to/from your computer's hard disk
- This utility does not read/write anything to/from Windows Registry.
- Windows OS will catch the message
- It will see that currently the window associated with Ms Word was active
- It will pass over your command in form of a message to Ms Word
- Each and every Windows based application contains a "Windows Message Message Pump" loop, which keeps watching for incoming messages from Windows OS
- In this case, the message pump inside Ms Word will catch the message that "user clicked somewhere".
- Then Ms Word will handle the message what ever way it wants to.
- If an application has not handled a certain message, the message will simply have no affect on its health and the application will just discard the message.
You might have noticed that I just provided C++ source code, and there ain't not C# .Net code as sample. I think its quite easy to setup p/Invoke calls these days, I am intentionally avoiding the topic as I want to keep the article short and to the point. Just if you've understood the scheme of things, you can easily setup a C#.Net or VB.Net version. (Update 2026: I finally went and wrote that version — except in PowerShell rather than C#/VB.Net, using the
Add-Type cmdlet to make the same P/Invoke call without a separate compile step. See the 2026 rewrite of this post for the one-liner, plus a section on what else PowerShell can do to a Windows system.)DISCLAIMER: There is no guarantee or warantee that this program will work as specified in this post. Author will not be responsible for any damage due to use of instructions provided in this post.

