Author: Jonas Bilinkevicius
How to change the system colours
Answer:
Solve 1:
1 2 procedure TMainForm.Button4Click(Sender: TObject);
3 var4 nColorIndex: array[1..2] of integer;
5 nColorValue: array[1..2] of longint;
6 begin7 nColorIndex[1] := COLOR_ACTIVECAPTION;
8 nColorIndex[2] := COLOR_BTNFACE;
9 nColorValue[1] := clBlue; {define the color you want}10 nColorValue[2] := clRed; {in that case is the caption bar and button color}11 SetSysColors(2, nColorIndex, nColorValue);
12 PostMessage(HWND_BROADCAST, WM_SYSCOLORCHANGE, 0, 0);
13 end;
You could have a look into the "Win32 API reference", under the "SetSysColors"
section. There, if you directly go to "GetSysColors" you'll get alist of the places
where you can change the colors. (e.g taskbar, borders, etc). In your case use
COLOR_BACKGROUND and COLOR_DESKTOP.
Solve 2:
14 15 procedure TForm1.Button1Click(Sender: TObject);
16 const17 ColCount = 2;
18 Elements: array[0..ColCount - 1] of Integer = (COLOR_WINDOW, COLOR_WINDOWTEXT);
19 Colors: array[0..ColCount - 1] of TColorRef = (clBlue, clYellow);
20 begin21 ifnot SetSysColors(ColCount, Elements[0], Colors[0]) then22 RaiseLastWin32Error;
23 end;