i'm looking for a way to blank the screen with masm32. the reason a screensaver wont do is that i dont want the screen to unblank on every mouse/keyb activity. any suggestions?
Dreate a maximised window with no titlebar or border and fill it with whatever bckground colour you want. It is in fact a very simple task.
pardon my inaccuracy. the problem is not in filling it with any color, but in turning the screen lighting / monitor off :boohoo:
Have a look at this page.
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/winui/winui/windowsuserinterface/userinput/keyboardaccelerators/keyboardacceleratorreference/keyboardacceleratormessages/wm_syscommand.asp
You can use SendMessage with WM_SYSCOMMAND and SC_MONITORPOWER
This line below will shut off your screen..
Invoke SendMessage, HWND_BROADCAST, WM_SYSCOMMAND, SC_MONITORPOWER, 2
thnx, jckl. i'll get cracking :U
There should be a button on the monitor, try pressing it, I believe it will turn off the whole screen :cheekygreen:
{The SC_MONITORPOWER function will still allow reactivation of the screen when a keyboard/mouse event is detected.}
[attachment deleted by admin]
in fact there isn't.
if i get it right, there's no standard way to do it with monitorpower (or maybe only a very complicated one), and maybe no standard programmatic way at all. so unless someone has other ideas, i'm back to sq 1
Hello Erkki, check this out: http://www.masmforum.com/simple/index.php?topic=1897.0
Found it by typing "monitor standby" in the search box above. Good luck.
What is wrong with Hutch's suggestion - with black!. Then you have an easy programed control of blanking/unblanking. Keep it simple.
Chris :wink
Quote from: erkki on March 20, 2006, 10:39:04 PM
in fact there isn't.
There is no power button on the monitor? Could it be that the power button is not accessible because you are trying to control someone else's monitor, in an effort to hide your activities?
Mark Jones - the thread you found is on SC_MONITORPOWER, which is of no use for me, as it unblanks on keyb/mouse activity automatically (whereas i would want a custom unblank on, say, Esc only)
ChrisLeslie - i agree that black would be simpler, but black and poweoff/standby/low power have visible difference (on my lcd at least). with black the screen is still illuminated by backlighting, on the others not
MichaelW - i have a new laptop model with no monitor switch (only lcd/crt switch, which unfortunately doesnt work if i'm not connected to an external monitor. if it worked i'd happily use this lcd/crt to unblank my screen)
If you dont mind me asking may i know the reasons at which you need to make the screen non visable to the point where you do not want it to be reinstated on key press or mouse move?
jckl - my work requires me to write a lot, and i'm used to blind typing
I have seen where you need to have the Monitor Manufacturer's inf loaded, before you can get the "Green" features to work, if they are there in the first place. If Monitor is not "Green", then Black blanking is all you got. Some ( dumb ) monitors have power save function that are not controlled by software, but monitoring the VGA inputs.
Time to buy a new LCD flat panel with "Green" features???
Regards, P1 :8)
nope. the "green" (power saving?) features work ok - low power lcd, monitor off etc. i have the blank screen ("green", not black) screensaver. my problem is a generic one: screensavers and SC_MONITORPOWER unblank on user activity, whereas I WANT TO WRITE WITH MONITOR OFF, which seems to be impossible
do you think this problem could be approached with int 10h? pardon if it's a stupid suggestion, i'm new to masm32
Aaah I see what you're saying. Guess it's a matter of how Windows powers up the monitor on keypress then - maybe globally hook the keyboard and force it to bypass all windows callback messages? If that is even possible, I'm not certain. :wink
this would be one (but perhaps hopelessly complicated) way to work around the problem, yes
other ideas i have are:
- int 10h (which is more a flashback from 16-bit days than a solid idea) and
- finding a way to trick the system thinking that it is connected to an external monitor. this would make the lcd/crt switch key work, and the switch key could then be used to turn lcd on/off. by default the lcd/crt switch works only when the computer is connected to an external monitor
Create a new black desktop and let everything run on the old until to switch from or destroy the new desktop.
Regards, P1 :8)
yes, well, this would still be a black desktop - a solution i've already tried and discarded (see above) - not the lcd power off i want
Quote from: erkki on March 22, 2006, 12:22:08 AM
yes, well, this would still be a black desktop - a solution i've already tried and discarded (see above) - not the lcd power off i want
Seek manufacturer's help.
Regards, P1 :8)
the following code will turn off the monitor directly
invoke SendMessage, hWin,WM_SYSCOMMAND,SC_MONITORPOWER,2 ;MONITOR_OFF
but I want to do it gradually.
So, What I want is: I want to change monitor brightness or contrast.
but how?
would you like to give me a clue?
Thank you.
sorry for my bad english
It's not wise to fiddle with a user's settings, but it's not necessary.
Copy the contents of the screen to a memory bitmap, create a fullscreen window (make it 'on-top'), bitblt the bitmap to your window, then fade your bitmap, pause, copy to screen, repeat until black. And then put the screen into power-save mode, and destroy your window.
Thanks Tedd.
I found your program to be very useful.
a while back, the guys were having fun doing something similar
you will get a chuckle out of this stuff - and the code may be along the lines of what you want
there are a few examples in this thread
http://www.masm32.com/board/index.php?topic=2172.msg17208#msg17208
and one here by Erol
http://www.masm32.com/board/index.php?topic=13318.msg103634#msg103634