Author: Jonas Bilinkevicius
I want to get some desktop settings in variables, like background color etc. But I
don't want to use the registry, does anybody know a different way? I also want to
know the height of the taskbar, and the position of the taskbar (top of the screen,
bottom, left or right).
Answer:
For the following example put a RadioGroup on your form and give it 5 items:
1 implementation2 3 type4 TTaskBarPosition = (tpHide, tpBottom, tpLeft, tpRight, tpTop);
5 6 function FindTaskBarPos(aWorkArea: TRect): TTaskBarPosition;
7 begin8 if aWorkArea.Left <> 0 then9 begin10 Result := tpLeft;
11 Exit;
12 end;
13 if aWorkArea.Top <> 0 then14 begin15 Result := tpTop;
16 Exit;
17 end;
18 if aWorkArea.Right <> Screen.Width then19 begin20 Result := tpRight;
21 Exit;
22 end;
23 if aWorkArea.Bottom <> Screen.Height then24 begin25 Result := tpBottom;
26 Exit;
27 end;
28 Result := tpHide;
29 end;
30 31 procedure TForm1.FormCreate(Sender: TObject);
32 var33 WorkArea: TRect;
34 begin35 Color := clBackground;
36 SystemParametersInfo(SPI_GETWORKAREA, 0, @WorkArea, 0);
37 RadioGroup1.ItemIndex := Ord(FindTaskBarPos(WorkArea));
38 end;
39 40 end.