Your browser doesn't support JavaScript Common Dialog Box - Windows Programming

Common Dialog Box

Common dialogs are a set of predefined, standard dialogs that can be used in an application to carry out common tasks such as file selection, font selection, or colour selection. All the common dialog classes are derived from a common base class, CCommonDialog.

The behaviour and appearance of a common dialogue by set or altered by changing the parameters supplied to the dialog’s constructor or by setting various flags. All the common dialogs require the inclusion of the commdlg.h header file.

MFC CCommonDialog Classes are shown in the following table.

ClassPurpose
CColorDialogAllows the user to select or create a color
CFileDialogAllows the user to open or save a file
CFindReplaceDialogAllows the user to substitute one string for another
CFontDialogAllows the user to select a font from a list of available fonts
COleDialogUseful for inserting OLE objects
CPageSetupDialogAllows the user to set page measurement parameters
CPrintDialogAllows the user to set up the printer and print a document
CPrintDialogExPrinting and Print Preview for Windows 2000

For further detailed reading
https://docs.microsoft.com/en-us/cpp/mfc/reference/ccommondialog-class?view=vs-2019

Example

The following short program illustrates the use of the CColourDialog by changing the background colour of the windows to match that selected from the colour dialog box

Download Code