BlackOut – Screen Dimmer
Downloads:
Executable Vista/Win 7
Source Code (C#)
Description:
BlackOut is a multi-monitor screen dimmer application.
This application was designed to reduce the brightness of your monitor or monitors, this can been extremely useful if you find yourself working in a dark environment, it is also very effective at offering a bit of privacy in crowded areas.
Screen Shot(s):
Notable Code:
Method used to grow form to cover all monitors
**Win 7 uses Bounds in place of WorkingArea
/*
* move through all the screens setting x and y to the lowest settings
* then increase the form size to cover all screens.
* Do NOT use WindowState or it will revert to one screen.
*/
foreach (Screen tmpscr in Screen.AllScreens)
{
if (this.Location.X > tmpscr.WorkingArea.Location.X)
{
tmpLocationX = tmpscr.WorkingArea.Location.X;
}
if (this.Location.Y > tmpscr.WorkingArea.Location.Y)
{
tmpLocationY = tmpscr.WorkingArea.Location.Y;
}
tmpwidth += tmpscr.WorkingArea.Width;
tmpheight += tmpscr.WorkingArea.Height;
}
this.Width = tmpwidth;
this.Height = tmpheight;
this.Location = new Point(tmpLocationX, tmpLocationY);
Class used to ensure config window snaps to start bar regardless of location
public class taskBar
{
[DllImport("SHELL32", CallingConvention = CallingConvention.StdCall)]
static extern uint SHAppBarMessage(int dwMessage, ref APPBARDATA pData);
#region Struct RECT
[StructLayout(LayoutKind.Sequential)]
struct RECT
{
public int left;
public int top;
public int right;
public int bottom;
}
#endregion
#region Struct APPBARDATA
[StructLayout(LayoutKind.Sequential)]
struct APPBARDATA
{
public int cbSize;
public IntPtr hWnd;
public int uCallbackMessage;
public int uEdge;
public RECT rc;
public IntPtr lParam;
}
#endregion
#region Struct ABMsg
enum ABMsg : int
{
ABM_NEW = 0,
ABM_REMOVE = 1,
ABM_QUERYPOS = 2,
ABM_SETPOS = 3,
ABM_GETSTATE = 4,
ABM_GETTASKBARPOS = 5,
ABM_ACTIVATE = 6,
ABM_GETAUTOHIDEBAR = 7,
ABM_SETAUTOHIDEBAR = 8,
ABM_WINDOWPOSCHANGED = 9,
ABM_SETSTATE = 10
}
#endregion
#region Struct ABEdge
enum ABEdge : int
{
ABE_LEFT = 0,
ABE_TOP,
ABE_RIGHT,
ABE_BOTTOM
}
#endregion
#region Enum ABState
enum ABState : int
{
ABS_MANUAL = 0,
ABS_AUTOHIDE = 1,
ABS_ALWAYSONTOP = 2,
ABS_AUTOHIDEANDONTOP = 3,
}
#endregion
#region Enum TaskBarEdge
public enum TaskBarEdge : int
{
Bottom,
Top,
Left,
Right
}
#endregion
public Point touchSysTray(Form Form)
{
int x=0, y = 0;
APPBARDATA abd = new APPBARDATA();
//use if you want to return a different point if the taskbar is autohiding
#region TaskBar AutoHide Property
#endregion
uint ret = SHAppBarMessage((int)ABMsg.ABM_GETTASKBARPOS, ref abd);
switch (abd.uEdge)
{
case (int)ABEdge.ABE_BOTTOM:
y = abd.rc.top - Form.Height;
x = abd.rc.right - Form.Width;
break;
case (int)ABEdge.ABE_TOP:
y = abd.rc.bottom;
x = abd.rc.right - Form.Width;
break;
case (int)ABEdge.ABE_LEFT:
y = abd.rc.bottom - Form.Height;
x = abd.rc.right;
break;
case (int)ABEdge.ABE_RIGHT:
y = abd.rc.bottom - Form.Height;
x = abd.rc.left - Form.Width;
break;
}
return new Point(x, y);
}
}

Blackout is great but I need to be able to dim monitor on multimonitor setup 1 monitor dim 1 monitor not dim is possible to add?
To elaborate I would like to see a function which controls which monitor I can dim so I can have seperate controls per monitor.
@Matt
Thanks for the kind words and interest, that is an interesting idea, and I could see how it would be useful, I am currently a little to swamped to make that change, but when I get some free time, I’ll see if I can make the change. It honestly wouldn’t be to hard, I would just have to spawn a form for each monitor detected, resize the forms to fit their monitor, and then set up a method to control the opacity for each. The code is available, and love to see anyone else interested make the changes.
If I do have the chance to make the changes I’ll post the results here and email you, once again thanks for your interest and feedback.
I like this program. I wish that it dimmed the taskbar as well, though.
@V
This application has been updated, it should now properly cover the toolbar section in windows 7 and Vista
New version Win 7 update
I would also love to see an option to control the dimming of monitors individually, for example when I watch movies or play games on one, being able to dim the other.
This would also be helpful so you could adjust the monitors to eachother if they have different brightness
Just what I was looking for, thanks!
@stealz
I agree, that would be useful.
It would be nice to have an option to toggle whether or not to dim the taskbar.
this functionality is currently available from the tray icon, I haven’t ported the code to use win7 method for adding functionality to the taskbar, and probably won’t be anytime soon, sorry of the inconvenience