staf_simons
asked on
changing system color
I've tried to change the colorsettings for the active window title with SetSysColors. The function return <>0 but nothing happens!!
(GetSysColor seems to work)
OS = win98 and delphi4
help,
(GetSysColor seems to work)
OS = win98 and delphi4
help,
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Ok, I found my bug.
ASKER
hi inthe,
ok, you set me the way but...
it works fine with 1 color change but i have to do it with 6!!!
now i do it 1 at a time and it's ok but it must be possible to do them all at once dont't you think ?
regards
staf
ok, you set me the way but...
it works fine with 1 color change but i have to do it with 6!!!
now i do it 1 at a time and it's ok but it must be possible to do them all at once dont't you think ?
regards
staf
ASKER
hi Barry,
what's the reason u make an array [1..5]
and only use 1 entry?....
i think the solution is there somewhere
staf
what's the reason u make an array [1..5]
and only use 1 entry?....
i think the solution is there somewhere
staf
>>what's the reason u make an array
>>[1..5] and only use 1 entry?....
hehe ,i have no idea there must have been a reason..
(the code is from one of my first e.e questions so was a while ago since i tried it)
if you want to use more of the colors
just use more of the array and call
SetSysColors(n,ColorIndex,
where n is amount of colors to change.
let me know how it goes i'll be back tommorow sometime to check was ok.
ASKER
hihi,
first of all, it works but why ???
unit
..
..
..
var
SysColorNames : array[0..6] of WORD
SysColorValues : array[0..6] od DWORD
implementation
..
..
..
procedure TForm1.FormCreate(Sender : TObject);
..
..
SysColorNames[0] := COLOR_ACTIVECAPTION;
SysColorNames[1] := COLOR_INACTIVECAPTION;
SysColorNames[2] := COLOR_GRADIENTACTIVECAPTIO N;
SysColorNames[3] := COLOR_GRADIENTINACTIVECAPT ION;
SysColorNames[4] := COLOR_CAPTIONTEXT;
SysColorNames[5] := COLOR_INACTIVECAPTIONTEXT;
..
..
..
procedure TForm1.ChangeSysColorCapti on
..
..
..
color1 := ColorToRGB(clWhite);
color2 := ColorToRGB(clBlack);
SysColorValues[0] := color1;
SysColorValues[1] := color1;
SysColorValues[2] := color1;
SysColorValues[3] := color1;
SysColorValues[4] := color2;
SysColorValues[5] := color2;
SetSysColors(6,syscolorNam es,syscolo rValues);
---------
see what is the result of that !!!
when you put
SysColorValues[2] := SysColorValues[4];
just before SetSysColors and you change that line to
SetSysColors(3,syscolorNam es,syscolo rValues);
then it works !!!
so problem solved but ....
regards staf
first of all, it works but why ???
unit
..
..
..
var
SysColorNames : array[0..6] of WORD
SysColorValues : array[0..6] od DWORD
implementation
..
..
..
procedure TForm1.FormCreate(Sender : TObject);
..
..
SysColorNames[0] := COLOR_ACTIVECAPTION;
SysColorNames[1] := COLOR_INACTIVECAPTION;
SysColorNames[2] := COLOR_GRADIENTACTIVECAPTIO
SysColorNames[3] := COLOR_GRADIENTINACTIVECAPT
SysColorNames[4] := COLOR_CAPTIONTEXT;
SysColorNames[5] := COLOR_INACTIVECAPTIONTEXT;
..
..
..
procedure TForm1.ChangeSysColorCapti
..
..
..
color1 := ColorToRGB(clWhite);
color2 := ColorToRGB(clBlack);
SysColorValues[0] := color1;
SysColorValues[1] := color1;
SysColorValues[2] := color1;
SysColorValues[3] := color1;
SysColorValues[4] := color2;
SysColorValues[5] := color2;
SetSysColors(6,syscolorNam
---------
see what is the result of that !!!
when you put
SysColorValues[2] := SysColorValues[4];
just before SetSysColors and you change that line to
SetSysColors(3,syscolorNam
then it works !!!
so problem solved but ....
regards staf
hey this setsyscolors is a bit mental ;-)
this must be why i was doing one at a time in original example.
it certainly dont seem to work as the documentation(in win32.hlp) discusses..
this must be why i was doing one at a time in original example.
it certainly dont seem to work as the documentation(in win32.hlp) discusses..
procedure TForm1.SpeedButton1Click(S
var AI : dword;
AC : array[0..2] of byte;
begin
AC[0]:=$00;
AC[1]:=$ff;
AC[2]:=$00;
AI:=COLOR_ActiveCaption;
SetSysColors(1,AI,AC);
end;
Cheers,
Igor.