DN_CTLCOLORDLGITEM

The DN_CTLCOLORDLGITEM event is sent to the dialog callback function before each dialog item is drawn.

Param1

ID of the dialog item that is about to be drawn.

Param2

Color attribute (foreground+background) that the callback function wants to use to draw dialog item:
DI_SINGLEBOX
DI_DOUBLEBOX
LO(LO=Title,HI=HiText), HI(LO=Frame,0)
DI_TEXT
LO(LO=Title,HI=HiText), HI(LO=Frame,0)
The box color applies only to text items with the DIF_SEPARATOR and DIF_SEPARATOR2 flags set.
DI_VTEXT
LO(LO=Title,HI=0), HI(0,0)
DI_EDIT
DI_FIXEDIT
DI_PSWEDIT
DI_COMBOBOX
LO(LO=EditLine,HI=SelectText), HI(LO=UnchangedColor, HI=History&ComboBox pointer)
DI_CHECKBOX
DI_RADIOBUTTON
LO(LO=Title,HI=HiText), HI(0,0)
DI_BUTTON
LO(LO=Title,HI=HiText), HI(0,0)
DI_LISTBOX
For the DI_LISTBOX item only the DN_CTLCOLORDLGLIST event is recieved.

Return

Color attribute (foreground+background) that the callback function should use to draw the dialog item.

Controls

ControlDescription
All Applies to all dialog items with the exception of DI_LISTBOX and DI_USERCONTROL

Remarks

Example

For example, this is how the macro assignment dialog in FAR Manager changes the color of input field:
/* 02 */ DI_EDIT,5,3,28,3,1,0,0,1,"",

case DN_CTLCOLORDLGITEM:
  // Unchanged resides in the Lo byte of the Hi word.
  Param2&=0xFF00FFFFU;
  Param2|=(Param2&0xFF)<<16;
  return Param2;
See also:
DialogEx