Common Dialog Box Library (COMdlg32.dll)

The Common Dialog Box Library (COMdlg32.dll) provides a set of standard dialog boxes that you can use to implement common user interface tasks in your Windows applications. These dialog boxes include file open and save, print, font selection, and color selection.

File Dialogs

Functions for displaying standard file open and save dialogs.

ChooseColorA / ChooseColorW

Displays a standard color-selection dialog box that lets the user choose a color.

Returns:

  • Nonzero if the user chooses a color and clicks OK.
  • Zero if the user cancels the dialog box or an error occurs.

Parameters:

Name Type Description
lpcc LPCHOOSECOLOR A pointer to a CHOOSECOLOR structure containing information about the dialog box.
Note: Use ChooseColorA for ANSI character sets and ChooseColorW for Unicode character sets.

ChooseFontA / ChooseFontW

Displays a standard font-selection dialog box that lets the user choose a font, font style, and font size.

Returns:

  • Nonzero if the user chooses a font and clicks OK.
  • Zero if the user cancels the dialog box or an error occurs.

Parameters:

Name Type Description
lpcf LPCHOOSEFONT A pointer to a CHOOSEFONT structure containing information about the dialog box.
Note: Use ChooseFontA for ANSI character sets and ChooseFontW for Unicode character sets.

GetOpenFileNameA / GetOpenFileNameW

Displays a standard file open dialog box that lets the user select a file to open.

Returns:

  • Nonzero if the user selects a file and clicks OK.
  • Zero if the user cancels the dialog box or an error occurs.

Parameters:

Name Type Description
lpofn LPOPENFILENAME A pointer to an OPENFILENAME structure containing information about the dialog box.
Note: Use GetOpenFileNameA for ANSI character sets and GetOpenFileNameW for Unicode character sets.

GetSaveFileNameA / GetSaveFileNameW

Displays a standard file save dialog box that lets the user specify a file name to save.

Returns:

  • Nonzero if the user specifies a file name and clicks OK.
  • Zero if the user cancels the dialog box or an error occurs.

Parameters:

Name Type Description
lpofn LPOPENFILENAME A pointer to an OPENFILENAME structure containing information about the dialog box.
Note: Use GetSaveFileNameA for ANSI character sets and GetSaveFileNameW for Unicode character sets.

Font Dialogs

Functions for displaying the font selection dialog box.

See also ChooseFontA / ChooseFontW in the File Dialogs section.

Color Dialogs

Functions for displaying the color selection dialog box.

See also ChooseColorA / ChooseColorW in the File Dialogs section.