How do I change the brightness/contrast/gamma of the desktop
How do I change the brightness/contrast/gamma of the desktop
Ive looked everywhere but cannot find how to change the brightness,contrast and gamma of the windows desktop. Ive looked at the win32 api help file and I still cannot find a call which will do this.
Is this possible?
Is this possible?
Re: How do I change the brightness/contrast/gamma of the des
Mabye because windows can't do this, because your VGA-driver will add this features.jrw wrote:Ive looked everywhere but cannot find how to change the brightness,contrast and gamma of the windows desktop. Ive looked at the win32 api help file and I still cannot find a call which will do this.
Is this possible?
And i Don't like programms, that change my complete PC...
Re: How do I change the brightness/contrast/gamma of the des
So you dont like powerstrip? ...GPI wrote:Mabye because windows can't do this, because your VGA-driver will add this features.jrw wrote:Ive looked everywhere but cannot find how to change the brightness,contrast and gamma of the windows desktop. Ive looked at the win32 api help file and I still cannot find a call which will do this.
Is this possible?
And i Don't like programms, that change my complete PC...
I just want to write a small utility to change the gamma/desktop and have several profiles.
Re: How do I change the brightness/contrast/gamma of the des
Try looking for Get/SetDeviceGammaRamp in the WinAPIjrw wrote:Ive looked everywhere but cannot find how to change the brightness,contrast and gamma of the windows desktop. Ive looked at the win32 api help file and I still cannot find a call which will do this.
Is this possible?
http://msdn.microsoft.com/library/defau ... m_0yi8.asp
http://www.nirsoft.net/vc/change_screen_brightness.html
I had the same idea some time ago

Ciao!
Re: How do I change the brightness/contrast/gamma of the des
I'm also looking to use this API but I keep getting a "The parameter is incorrect" error. Does anyone have some working sample code?
I want to adjust the gamma for everything displayed to the screen, not just one window:
I want to adjust the gamma for everything displayed to the screen, not just one window:
Code: Select all
Procedure.s ShowAPIError(CustomError=#False, ErrorCode=0)
Protected Buffer.s
Protected NumberOfChars
If Not CustomError
ErrorCode=GetLastError_()
EndIf
Buffer.s=Space(4096)
NumberOfChars=FormatMessage_(#FORMAT_MESSAGE_FROM_SYSTEM,0,ErrorCode,0,Buffer.s,Len(Buffer.s),0)
ProcedureReturn Left(Buffer.s,NumberOfChars-2)
EndProcedure
; Mem=AllocateMemory(SizeOf(Byte)*3)
; PokeL(Mem+SizeOf(Byte)*0,140)
; PokeL(Mem+SizeOf(Byte)*0,140)
; PokeL(Mem+SizeOf(Byte)*0,140)
; Dim GammaRamp(3,256)
Mem=AllocateMemory(SizeOf(Byte)*3*256)
Debug SetDeviceGammaRamp_(GetDC_(0),@Mem)
Debug ShowAPIError()
Repeat
Delay(1)
ForEver
Re: How do I change the brightness/contrast/gamma of the des
Try this:
It works on my nVidia card.
EDIT: WOW, just noticed I have posted code for an API I was talking about 6 years ago, and that one was my first post too ! The circle is complete
Code: Select all
Procedure.s ShowAPIError(CustomError=#False, ErrorCode=0)
Protected Buffer.s
Protected NumberOfChars
If Not CustomError
ErrorCode=GetLastError_()
EndIf
Buffer.s=Space(4096)
NumberOfChars=FormatMessage_(#FORMAT_MESSAGE_FROM_SYSTEM,0,ErrorCode,0,Buffer.s,Len(Buffer.s),0)
ProcedureReturn Left(Buffer.s,NumberOfChars-2)
EndProcedure
value = 64
Dim iGammaRamp.w(2,255)
For i = 0 To 255
iArrayValue = i * (value + 128)
If iArrayValue > 65535
iArrayValue = 65535
EndIf
iGammaRamp(0,i) = iArrayValue
iGammaRamp(1,i) = iArrayValue
iGammaRamp(2,i) = iArrayValue
Next
Debug SetDeviceGammaRamp_(GetDC_(0),@iGammaRamp())
Debug ShowAPIError()
Repeat
Delay(1)
ForEver
EDIT: WOW, just noticed I have posted code for an API I was talking about 6 years ago, and that one was my first post too ! The circle is complete

"Have you tried turning it off and on again ?"
- Kwai chang caine
- Always Here
- Posts: 5494
- Joined: Sun Nov 05, 2006 11:42 pm
- Location: Lyon - France
Re: How do I change the brightness/contrast/gamma of the des
Works fine on VISTA
Thanks LUIS
Thanks LUIS


Not a destination
-
- Addict
- Posts: 1482
- Joined: Tue Feb 22, 2011 1:16 pm
Re: How do I change the brightness/contrast/gamma of the des
The Win32.hlp file has HUNDREDS of missing APIs. It's really old. Use the online MSDN search instead.jrw wrote:Ive looked at the win32 api help file and I still cannot find a call which will do this
Microsoft Visual Basic only lasted 7 short years: 1991 to 1998.
PureBasic: Born in 1998 and still going strong to this very day!
PureBasic: Born in 1998 and still going strong to this very day!
Re: How do I change the brightness/contrast/gamma of the des
...so is the post you've quoted.MachineCode wrote:The Win32.hlp file has HUNDREDS of missing APIs. It's really old. Use the online MSDN search instead.jrw wrote:Ive looked at the win32 api help file and I still cannot find a call which will do this

Btw: Nice code, working great on XP. But how can I set the gamma level back to normal?

If any of you native English speakers have any suggestions for the above text, please let me know (via PM). Thanks!
-
- Addict
- Posts: 1482
- Joined: Tue Feb 22, 2011 1:16 pm
Re: How do I change the brightness/contrast/gamma of the des
And your point is?c4s wrote:so is the post you've quoted.
Microsoft Visual Basic only lasted 7 short years: 1991 to 1998.
PureBasic: Born in 1998 and still going strong to this very day!
PureBasic: Born in 1998 and still going strong to this very day!
Re: How do I change the brightness/contrast/gamma of the des
I used this code:c4s wrote: But how can I set the gamma level back to normal?
http://www.nirsoft.net/vc/change_screen_brightness.html
value = 128 normal, < 128 darker, > 128 lighter
I suppose you can also use the GetDeviceGammaRamp() api to save the current settings and restore them if needed.
You can also alter RGB components separately to enhance/reduce a specific color channel.
BTW: this api was listed in the good old win32.hlp

"Have you tried turning it off and on again ?"
Re: How do I change the brightness/contrast/gamma of the des
I already saw GetDeviceGammaRamp_() but it doesn't make much sense after successfully testing your code.luis wrote:I used this code:c4s wrote: But how can I set the gamma level back to normal?
http://www.nirsoft.net/vc/change_screen_brightness.html
value = 128 normal, < 128 darker, > 128 lighter
I suppose you can also use the GetDeviceGammaRamp() api to save the current settings and restore them if needed.
You can also alter RGB components separately to enhance/reduce a specific color channel.
BTW: this api was listed in the good old win32.hlp

Well, I found it out myself by testing some values after I wrote my question. I just wasn't sure about 127 or 128...thanks anyway!
If any of you native English speakers have any suggestions for the above text, please let me know (via PM). Thanks!