I am looking into modifying brightness/contrast/gamma of my display i found an api whose purpose i think is this but i didn’t had much success implementing it… here is the code
var
i,j:Integer;
buf:array [0..2,0..255] of Word;
wBright:Word;
myDC:HDC;
begin
myDC:=GetDc(GetDesktopWindow);
GetDeviceGammaRamp(mydc,buf);
for i:=0 to 2 do
for j:=0 to 255 do
begin
buf[i][j]:=buf[i][j] + 100; //if i don't modify the values the api works
end;
SetDeviceGammaRamp(mydc,buf);
end;
I will be grateful if you point me into right direction. Thanks.
The last error says : The parameter is incorrect
The values in the array must really be a ramp, i.e. they map the possible R, G and B values to a brightness value. This way you can create funny effects too, but not with the routine below. Found something like this on the web:
Unfortunately, in my Win7 VM in Parallels on a Mac, I can’t test his, but it should work on most normal Windows PCs.
Edit
FWIW, I ran it in my Win7 VM and the routine returns
True. If I use other values, e.g.the routine returns
Falseanddisplays
Changing this to:
returns
Trueagain. I assume the values must form some kind of slope (or ramp). This routine creates a linear ramp. I guess you can also use other kinds, e.g. a sigmoid, to achieve other effects, like higher contrast.I can’t, of course, see any differences in brightness in the VM, sorry.
Update: But it seems to work for David Heffernan and I could just test it on my sister in law’s laptop, and there it works too.