I want to get Aero color:
I wrote this:
Delphi-Quellcode:
var
Params: TColorizationParams;
begin
if IsAeroEnabled
then
begin
if Assigned(DwmGetColorizationParameters)
then
begin
ZeroMemory(@Params, SizeOf(Params));
DwmGetColorizationParameters(Params);
Result :=
RGB(GetBValue(Params.clrColor), GetGValue(Params.clrColor), GetRValue(Params.clrColor));
end;
end;
end;
It working, but because uses undocumented function (I got pointer, because I know offset), I tried again with documented function:
Delphi-Quellcode:
var
pcrColorization: DWORD;
pfOpaqueBlend: BOOL;
A, R, G, B: Integer;
begin
if IsAeroEnabled
then
begin
if DwmGetColorizationColor(pcrColorization,pfOpaqueBlend) = S_OK
then
begin
A := (pcrColorization
and $FF000000)
shr 24;
R := (pcrColorization
and $FF0000)
shr 16;
G := (pcrColorization
and $FF00)
shr 8;
B := (pcrColorization
and $FF);
R := Min(255, Max(0, R + (255 - A - 40)));
G := Min(255, Max(0, G + (255 - A - 40)));
B := Min(255, Max(0, B + (255 - A - 40)));
Result :=
RGB(R, G, B);
end;
end;
end;
Above formula I got from [
DP]http://www.delphipraxis.net/147316-vista-win7-aero-farbe-auslesen.html[/
DP]. It's not valid of course (color processing inside).
AARRGGBB, so I tried also:
Delphi-Quellcode:
R := (pcrColorization shr 16) and $FF;
G := (pcrColorization shr 8) and $FF;
B := pcrColorization and $FF;
but color too dark. How to decode this color?