Delphi 屏幕亮度调整

uses shellapi;
TRampArray=array[0..2] of array[byte] of Word;

function TfrmKaiJi.SetBrightness( wBrightness: word ): boolean;
var
RampArray: TRampArray;
i, Value: integer;
DC: HDC;
begin
for i := 0 to MAXBYTE do
begin
Value := i * ( wBrightness + 128 );
if ( Value > MAXWORD ) then Value := MAXWORD;
RampArray[0][i] := Value;
RampArray[1][i] := Value;
RampArray[2][i] := Value;
end;

DC := GetDC( 0 );
try
Result := SetDeviceGammaRamp( DC, RampArray );
finally
ReleaseDC( 0, DC );
end;
end;

posted @ 2018-10-15 10:47  丹心石  阅读(500)  评论(0编辑  收藏  举报