ChooseColorDlg method

Opens the system color-selection dialog box.

Syntax

HRESULT retVal = object.ChooseColorDlg(initColor, rgbColor);

Parameters

  • initColor [in, optional]
    Type: VARIANT

    A VARIANT that specifies the RGB value of the initial color selected in the color-selection dialog box. The value is specified as 0xrrggbb where rr is the red hex value, gg is the green hex value, and bb is the blue hex value. For a complete list of colors, see Color Table.

  • rgbColor [out, retval]
    Type: VARIANT

    A pointer to a VARIANT that specifies the decimal value of the color chosen in the color-selection dialog box. The value must be converted to its hexadecimal equivalent and is specified as 0xrrggbb.

Return value

Type: HRESULT

If this method succeeds, it returns S_OK. Otherwise, it returns an HRESULT error code.

Standards information

There are no standards that apply here.

Remarks

There is no way to persist custom colors in this dialog box.

The return value of this method must be converted from decimal to hexadecimal before it can be used to change the collor of an object. The hexadecimal number must contain six digits to represent the RRGGBB schema required by the color table. For numbers with less than six numbers, concatenate zeros to the beginning of the number. For more information, see the Color Table.

IHtmlDlgSafeHelper::ChooseColorDlg was introduced in Microsoft Internet Explorer 6.