[Lazarus] SetSysColors

Michael Van Canneyt michael at freepascal.org
Tue Jun 5 22:17:22 CEST 2018


Hello,


If I execute the following at the start of the program:

uses lcltype, lclintf, graphics;

Procedure sc;

Var
   el : Integer;
   col : Integer;
   P1,P2 : PInteger;

begin
   Col:=ColorToRGB(clRed);
   el:=COLOR_WINDOW;
   P1:=@el;
   p2:=@col;
   SetSysColors(1,P1,p2);
end;

I would expect that the window color is red, and all windows which have
clDefault or clWindow as color become red.

No such thing happened. I tried setting some other colors, but to no avail.

Is this supposed to work ?

Aside from the question whether it is supposed to work, why is the signature
of this call using 2 untyped const parameters ?

If I look at
https://msdn.microsoft.com/en-us/library/windows/desktop/ms724940(v=vs.85).aspx
it clearly uses (typed) pointers.

Michael.



More information about the Lazarus mailing list