DonationCoder.com forum
 
Read-only archive. This is a static copy of the DonationCoder.com forum. Reading and searching work as before; logging in, posting and private messages do not.
Archive of 2026-10-21 · About this archive · Main site

Author Topic: Monitor Dimmer  (Read 38,048 times)

mmdoogie

  • Supporting Member
  • Joined in 2006
  • **
  • Posts: 14
    • Coding Snacks
Monitor Dimmer
« on: January 23, 2008, 07:43 AM »
I guess this program could be a little more flexible, and its not that amazing, but I wanted to share it as it fulfilled a need I had.
Also, I wanted to share the technique I used as it took me a while to get it to work the way I wanted.

Background:

I have two monitors.
Often, I'll watch a movie or play a game on the left one, while I will also be browsing web pages and chatting with people on the right one.
If the movie or game is dark, and I'm looking a mostly white webpage, there is too much light.

Solution:

This program creates a window.  A variable-alpha-transparency, black, always-on-top window, with no titlebar, etc.
It covers my entire right monitor.  BUT, by setting WS_EX_TRANSPARENT, its made transparent to events, and thus mouse clicks, keystrokes, etc. are passed on through to the windows below it.

Win Numpad+ darkens the screen, Win Numpad- lightens the screen, Win Numpad* toggles the overlay on/off.

Getting WS_EX_TRANSPARENT set in an AHK script is as simple as adding +E0x20 to the Gui creation command.

So, without further ado, I present -- MonitorDimmer.
In both AHK and EXE.

Enjoy!
--matt

jgpaiva

  • Artificial Idiocy
  • Global Moderator
  • Joined in 2006
  • *****
  • Posts: 4,727
    • Cody Award
    • Participated in NANY Challenge Once
    • Coding Snacks
    • Portugal Inhabitant
    • Linux User
Re: Monitor Dimmer
« Reply #1 on: January 23, 2008, 11:48 PM »
:D cool!
Thanks matt

Ehtyar

  • That News Guy
  • Supporting Member
  • Joined in 2007
  • **
  • Posts: 1,237
    • Plugin Coding Medal
    • Gathering Badge
Re: Monitor Dimmer
« Reply #2 on: January 24, 2008, 12:16 AM »
If you're interested in setting the brightness of the entire screen, you can try the Windows gamma ramp API. I've used it myself, very helpful.

Ehtyar.

mmdoogie

  • Supporting Member
  • Joined in 2006
  • **
  • Posts: 14
    • Coding Snacks
Re: Monitor Dimmer
« Reply #3 on: January 24, 2008, 01:11 AM »
Thanks for the API link Ehtyar.

When I started this, a friend suggested I look at the gamma settings of my graphics card.

However, I have my monitors color-managed, and the control panel disabled the gamma setting because of that,
so I have a suspicion that something like this would not work in my case.

Here is a much nicer version of the program.
It works with arbitrary monitor numbers, (instead of being hardcoded for my monitor sizes  8)),
and remembers dimming and show settings between launches.

mouser

  • First Author
  • Administrator
  • Joined in 2005
  • *****
  • Posts: 40,931
    • Gathering Badge
    • Plugin Coding Medal
    • Participated in NANY Challenge Seventeen Times
    • Cody Award
    • Coding Snacks
    • Volunteers/Staff
Re: Monitor Dimmer
« Reply #4 on: January 24, 2008, 07:41 AM »
cool  :up:

nosh

  • Supporting Member
  • Joined in 2007
  • **
  • Posts: 1,441
Re: Monitor Dimmer
« Reply #5 on: January 25, 2008, 12:22 AM »
This'll really help, I usually disable mon2 while watching movies and all my apps there jump to mon1.  :D
Thanks!

bliss

  • la la la-la
  • Charter Member
  • Joined in 2006
  • ***
  • Posts: 19
Re: Monitor Dimmer
« Reply #6 on: May 26, 2008, 07:24 AM »
So good I've put it into my startup. I might make double-click choose 'toggle' and find a nice icon though if thats ok. Thanks!
Am we there yet?

BigJim

  • I have seen the light!
  • Supporting Member
  • Joined in 2007
  • **
  • Posts: 178
Re: Monitor Dimmer
« Reply #7 on: May 26, 2008, 02:57 PM »
I think that this little program is pretty neat! Thanks  :Thmbsup:

My use of it is just slightly different in that I don't often watch movies on my dual monitor setup. But I am frequently working in one application on one monitor while having to keep an eye on something on the other. So it's nice to have the one of lesser interest dimmed slightly. But when my focus shifts I'd like to be able to quickly swap the dimming effect to the other monitor. Any chance of incorporating that as a hot key rather than having to go through several mouse clicks to achieve it?

A nice icon will be fun, too.

Thanks for sharing, as they say.    :)
TruckerJim says "You can go down a hill too slow a thousand times. But too fast only once."

mmdoogie

  • Supporting Member
  • Joined in 2006
  • **
  • Posts: 14
    • Coding Snacks
Re: Monitor Dimmer
« Reply #8 on: May 27, 2008, 07:21 AM »
A different icon would be nice -- I have trouble coming up with that kind of thing  :)

A suggestion on moving between the two monitors, and the one I use (because I already use the program for other things)
http://www.donationcoder.com/forum/index.php?topic=7482.msg53390#msg53390

I'm glad other people are finding use for this -- I knew I couldn't be the only one that could need it!

--matthew

BigJim

  • I have seen the light!
  • Supporting Member
  • Joined in 2007
  • **
  • Posts: 178
Re: Monitor Dimmer
« Reply #9 on: May 27, 2008, 12:07 PM »
MoveToMon is an interesting solution but, unfortunately, not one that works for me in this situation. The way I have my screen real estate carved up moving applications from one monitor to the other would only serve to make a jumble of things,
TruckerJim says "You can go down a hill too slow a thousand times. But too fast only once."

mmdoogie

  • Supporting Member
  • Joined in 2006
  • **
  • Posts: 14
    • Coding Snacks
Re: Monitor Dimmer
« Reply #10 on: May 27, 2008, 01:46 PM »
Oh I'm sorry... I didn't mean to suggest that you move your applications from monitor-to-monitor.
If you deactivate then reactivate the monitor dimmer, its the active window and you can use the MoveToMon hotkeys to move the dimmer between monitors.

--matthew

BigJim

  • I have seen the light!
  • Supporting Member
  • Joined in 2007
  • **
  • Posts: 178
Re: Monitor Dimmer
« Reply #11 on: May 27, 2008, 06:53 PM »
Ah!  :-[ I get it. Thanks. :up:

That certainly does work although it's a little finicky - easy to not have the focus where you intend and/or several key/mouse strokes to run it the way you suggest. Also you must load two scripts instead of one. It would be fun to have that functionality built into Monitor Dimmer so that was the only thing that it moved and did it with a single keystroke (e.g. Win Numpad/ ?) ... IMHO.

Cheers!
Jim
TruckerJim says "You can go down a hill too slow a thousand times. But too fast only once."

Original address: https://www.donationcoder.com/forum/index.php?topic=11973.0