Odczyt i zapis koloru do rejestru

0

Witam.
Napisałem sobie taki oto kod:

 Registry.RootKey := HKEY_CURRENT_USER;
  Registry.OpenKey( 'SOFTWARE\Microsoft\Windows\CurrentVersion\Themes\Personalize', False );
  if Registry.ValueExists( 'SpecialColor' ) then begin
    ReadInt := Registry.ReadInteger( 'SpecialColor' );
    ColorBox_RegTheme_CustomColor.Selected := RGB( StrToInt('$' + copy( IntToHex( ReadInt, 8 ) ,7,2)),
                                                   StrToInt('$' + copy( IntToHex( ReadInt, 8 ) ,5,2)),
                                                   StrToInt('$' + copy( IntToHex( ReadInt, 8 ) ,3,2)) );
  end else begin
    ColorBox_RegTheme_CustomColor.Selected := clWhite;
  end;
  Registry.CloseKey;

wyciąga on kolor z rejestru (Windows 10 custom theme color )

Następnie próbowałem wrzucić zmodyfikowany kolor, ale niestety nie wrzucił się już taki sam tylko inny :/
Kod jest następujący:

  Registry.RootKey := HKEY_CURRENT_USER;
  Registry.OpenKey( 'SOFTWARE\Microsoft\Windows\CurrentVersion\Themes\Personalize', False );
  WriteInt := StrToInt( IntToStr((ColorBox_RegTheme_CustomColor.Selected and $ff0000) shr 16) +
                        IntToStr((ColorBox_RegTheme_CustomColor.Selected and $ff00) shr 8) +
                        IntToStr(ColorBox_RegTheme_CustomColor.Selected and $ff));
  Registry.WriteInteger( 'SpecialColor', WriteInt );
  Registry.CloseKey;

problem jest prawdopodobnie taki że pobieram ARGB a zapisuję RGB
W rejestrze to wygląda tak: ffd77800, ja pobieram jedynie d77800.
Co zrobić by kolor zapisywany się zgadzał z tym co chciałbym zapisać ?

1

Przy zapisywaniu dodaj mu ff na początku?

1 użytkowników online, w tym zalogowanych: 0, gości: 1