The hook procedure of a Color dialog box can send the SETRGBSTRING registered message to the dialog box to set the current color selection.
MessageID = RegisterWindowMessage(SETRGBSTRING);
wParam = 0;
lParam = (COLORREF) rgbColor;
No return value.
If rgbColor matches one of the basic colors or one of the 16 custom colors, the dialog box procedure selects that color. The dialog box procedure also updates all the controls in the custom color extension of the Color dialog box, if it is open.
If rgbColor does not match a basic or custom color, the dialog box procedure does not change the current color selection, but it does update the custom color controls, if they are visible.
For example, the following sample code gets the SETRGBSTRING message identifier and then sets the color selection to blue.
UINT uiSetRGB;
uiSetRGB = RegisterWindowMessage(SETRGBSTRING);
SendMessage(hwndDlg, uiSetRGB, 0, (LPARAM) RGB(0, 0, 255));
Windows NT: Requires version 3.1 or later.
Windows: Requires Windows 95 or later.
Windows CE: Unsupported.
Header: Declared in commdlg.h.
Unicode: Defined as Unicode and ANSI messages.
Common Dialog Box Library Overview, Common Dialog Box Messages, RegisterWindowMessage, RGB, SendMessage