Hi Maddy,
once i had a fellow developer who had
problems with his eyes in bright rooms
and i wrote this for him. It modifies the
displays gamm ramp values and makes
it very dark. It is written in VB6 but it
should be n match to move it to C# for
you:
Private DeviceRampDefault(0 To 255, 0 To 2) As Integer
Private AdjustedDeviceRamp(0 To 255, 0 To 2) As Integer
Private Declare Function GetDeviceGammaRamp Lib "gdi32" (ByVal hdc As Long,
lpv As Any) As Long
Private Declare Function SetDeviceGammaRamp Lib "gdi32" (ByVal hdc As Long,
lpv As Any) As Long
Private Declare Sub CopyMemory Lib "kernel32" Alias "RtlMoveMemory"
(Destination As Any, Source As Any, ByVal Length As Long)
Private Sub CheckASGRSetGammaRamp_Click()
If Me.CheckASGRSetGammaRamp.Value = Checked Then
SetDarkGammaRamp
Else
SetDeviceGammaRamp Me.hdc, DeviceRampDefault(0, 0)
End If
End Sub
Private Sub commandASGRExit_Click()
mnuExit_Click
End Sub
Private Sub Form_Load()
Me.Caption = App.ProductName & " " & App.Major & "." & App.Minor
GetDeviceGammaRamp Me.hdc, DeviceRampDefault(0, 0)
End Sub
Private Sub Form_Unload(Cancel As Integer)
If Me.CheckASGRRestoreOnExit.Value = Checked Then
SetDeviceGammaRamp Me.hdc, DeviceRampDefault(0, 0)
End If
End Sub
Private Sub mnuAbout_Click()
Dim HelpMessage As String
HelpMessage = App.ProductName & " " & App.Major & "." & App.Minor & vbCrLf
_
& "by Kerem Gümrükcü" & vbCrLf _
& "Contact:
ke*****@arcor.de"
MsgBox HelpMessage, vbOKOnly Or vbInformation Or vbApplicationModal,
App.ProductName & " " & App.Major & "." & App.Minor
End Sub
Private Function SetDarkGammaRamp()
Dim iItr As Integer
Dim lVal As Long
For iItr = 0 To 255
lVal = IntToLng(DeviceRampDefault(iItr, 0))
AdjustedDeviceRamp(iItr, 0) =
LngToInt(IntToLng(DeviceRampDefault(iItr, 0)) / 2)
AdjustedDeviceRamp(iItr, 1) =
LngToInt(IntToLng(DeviceRampDefault(iItr, 1)) / 2)
AdjustedDeviceRamp(iItr, 2) =
LngToInt(IntToLng(DeviceRampDefault(iItr, 2)) / 2)
Next iItr
SetDeviceGammaRamp Me.hdc, AdjustedDeviceRamp(0, 0)
End Function
Private Sub mnuExit_Click()
Unload Me
End Sub
Public Function IntToLng(IntVal As Integer) As Long
CopyMemory IntToLng, IntVal, 2
End Function
Public Function LngToInt(Value As Long) As Integer
CopyMemory LngToInt, Value, 2
End Function
--
-----------------------
Beste Grüsse / Best regards / Votre bien devoue
Kerem Gümrükcü
Latest Project:
http://www.codeplex.com/restarts
Latest Open-Source Projects:
http://entwicklung.junetz.de
-----------------------
"This reply is provided as is, without warranty express or implied."