I need to change the random system color to change to a random color. Here's what I got:

alt text

Where is the mistake?

2 answers 2

Variable required

We look at the signature of the procedure

procedure SetSysColors(Changes: Integer; var SysColor: Integer; var ColorValues: Longint); 

for SetSysColors second and third parameters must be variables.

  • one
    Thank!!! And why variables? - delphikettle
  • one
    This is due to the fact that the corresponding WinAPI function requires pointers as parameters. BOOL SetSysColors (int cElements, CONST INT * lpaElements, CONST COLORREF * lpaRgbValues); - Nofate
  • Good question. In fact, scold Baglad for this, the signature is incorrect. - karmadro4
  • @Nofate, just the opposite! You have right in copy-paste __in const written. - karmadro4
  • 2
    AND? INT *lpaElements - pointer to intu. When the TC calls rgb return result is put somewhere in eax and the compiler does not convert it to an address in any way. Therefore, a variable is required explicitly. // I feel that you want to catch me on something or have already caught it)) // / * and it seems to me that @ karamdro4 is my personal troll angel) * / - Nofate

Try to push before api function