CHOOSECOLOR

This structure contains information the ChooseColor function uses to initialize the Color common dialog box. After a user closes the dialog box, the system uses this structure to return information about the user's selection.

typedef struct tagCHOOSECOLOR {
  DWORD lStructSize;
  HWND hwndOwner;
  HINSTANCE hInstance;
  COLORREF rgbResult;
  COLORREF* lpCustColors;
  DWORD Flags;
  LPARAM lCustData;
  LPCCHOOKPROC lpfnHook;
  LPCTSTR lpTemplateName;
} CHOOSECOLOR, *LPCHOOSECOLOR;

Members

  • lStructSize
    Specifies the length, in bytes, of the structure.
  • hwndOwner
    Handle to the window that owns the dialog box. This member can be any valid window handle, or it can be NULL if the dialog box has no owner.
  • hInstance
    If the CC_ENABLETEMPLATEHANDLE flag is set in the Flags member, this member is the handle of a memory object that contains a dialog box template. If the CC_ENABLETEMPLATE flag is set, hInstance identifies a module that contains a dialog box template named by the lpTemplateName member. If neither CC_ENABLETEMPLATEHANDLE nor CC_ENABLETEMPLATE is set, this member is ignored.
  • rgbResult
    If the CC_RGBINIT flag is set, this member specifies the color initially selected when the dialog box is created. If the specified color value is not among the available colors, the system selects the nearest solid color available. If rgbResult is zero or CC_RGBINIT is not set, the initially selected color is black. If the user clicks the OK button, rgbResult specifies the user's color selection.
  • lpCustColors
    Long pointer to an array of 16 COLORREF values that contain red, green, blue (RGB) values for the custom color boxes in the dialog box. If the user modifies these colors, the system updates the array with the new RGB values. To preserve new custom colors between calls to the ChooseColor function, you should allocate static memory for the array.
  • Flags
    Set of bit flags used to initialize the Color common dialog box. When the dialog box returns, it sets these flags to indicate the user's input. This member can be a combination of the following flags.
    Value Description
    CC_ANYCOLOR Causes the dialog box to display all available colors in the set of basic colors.
    CC_ENABLEHOOK Enables the hook procedure specified in the lpfnHook member of this structure. This flag is used only to initialize the dialog box.
    CC_ENABLETEMPLATE Indicates that the hInstance and lpTemplateName members specify a dialog box template to use in place of the default template. This flag is used only to initialize the dialog box.
    CC_ENABLETEMPLATEHANDLE Indicates that the hInstance member identifies a data block that contains a preloaded dialog box template. The system ignores the lpTemplateName member if this flag is specified. This flag is used only to initialize the dialog box.
    CC_FULLOPEN Causes the dialog box to display the additional controls that allow the user to create custom colors. If this flag is not set, the user must click the DefineCustomColor button to display the custom color controls.
    CC_PREVENTFULLOPEN Disables the DefineCustomColors button.
    CC_RGBINIT Causes the dialog box to use the color specified in the rgbResult member as the initial color selection.
    CC_SOLIDCOLOR Causes the dialog box to display only solid colors in the set of basic colors.
  • lCustData
    Specifies application-defined data that the system passes to the hook procedure identified by the lpfnHook member. When the system sends the WM_INITDIALOG message to the hook procedure, the message's lParam parameter is a pointer to the CHOOSECOLOR structure specified when the dialog was created. The hook procedure can use this pointer to get the lCustData value.
  • lpfnHook
    Long pointer to a CCHookProc hook procedure that can process messages intended for the dialog box. This member is ignored unless the CC_ENABLEHOOK flag is set in the Flags member.
  • lpTemplateName
    Long pointer to a null-terminated string that names the dialog box template resource in the module identified by the hInstance member. This template is substituted for the standard dialog box template. For numbered dialog box resources, lpTemplateName can be a value returned by the MAKEINTRESOURCE macro. This member is ignored unless the CC_ENABLETEMPLATE flag is set in the Flags member.

Requirements

OS Versions: Windows CE 2.0 and later.
Header: Commdlg.h.

See Also

CCHookProc | ChooseColor | COLORREF | MAKEINTRESOURCE | WM_INITDIALOG

Last updated on Wednesday, April 13, 2005

© 2005 Microsoft Corporation. All rights reserved.