LCDoff.exe

This program will disable your LCD or monitor when executed. Useful for conserving battery, screen life, and privacy. Very handy for overriding software that blocks the automatic screen powerdown (like Synergy).

Download LCDOff.exe

It should work on fairly old systems, back to Windows NT 3.1 and Windows 95, unlike the C# versions elsewhere. It is also 7.5kb vs 85kb.

I wrote it in MASM using the Irvine library for convenience. Optimized with http://upx.sourceforge.net/

Rational:

I recently upgraded my trusty ThinkPad T42 to Windows 7. Unfortunately, the screen-off keystroke no longer works. Some quick Googling showed that people made their own handlers in C#. Well, that sucks if you don't have the .net CLR. This is not a problem on Windows 7, but I also wanted to try out my Assembly skills since they were all just calling standard Win32 APIs.

Source Code:

TITLE Monitor Off (main.asm)  
; Description: This program turns off your monitor (power saving mode)  
; Revision date: 2 November 2009

INCLUDE Irvine32.inc  
INCLUDELIB Kernel32.lib  
INCLUDELIB User32.lib

SendMessageA PROTO :DWORD,:DWORD,:DWORD,:DWORD  
GetConsoleWindow PROTO

WM_SYSCOMMAND = 0112h  
SC_MONITORPOWER = 0F170h  
OFF = 2

.data  
msg BYTE "Monitor off. Program from Kev009.com",0dh,0ah,0

.code  
main PROC

call Clrscr

; Get our window handle to send the event to  
INVOKE GetConsoleWindow  
; The handle is now in eax  
INVOKE SendMessageA, eax, WM_SYSCOMMAND, SC_MONITORPOWER, OFF

mov edx,OFFSET msg  
call WriteString

exit  
main ENDP  
END main  

Comments

comments powered by Disqus