CommonDialog - Flags


File Open, Save As dialog boxes

Flag

Value

Description

OFNAllowMultiselect

&H200

Specifies that the File Name listbox allows multiple selections. When this is done, the FileName property returns a string containing the names of all selected files. The names in the string are delimited by spaces

OFNCreatePrompt

&H2000

Specifies that the dialog box prompts the user to create a file that doesn't currently exist. This flag automatically sets the OFNPathMustExist and OFNFileMustExist flags

OFNExplorer

&H80000

Use the Explorer-like Open A File dialog box template. Works with Windows 95 and Windows NT 4.0

OFNExtensionDifferent

&H400

Indicates that the extension of the returned filename is different from the extension specified by the DefaultExt property. This flag isn't set if the DefaultExt is Null, if the extensions match, or the file has no extension. This flag value can be checked upon closing the dialog box

OFNFileMustExist

&H1000

Specifies that the user can enter only names of existing files in the File Name text box. If this flag is set and the user enters an invalid filename, a warning is displayed. This flag automatically sets the OFNPathMustExist flag.

OFNHelpButton

&H10

Causes the dialog box to display the Help button

OFNHideReadOnly

&H4

Hides the Read Only checkbox

OFNLongNames

&H200000

Use long filenames

OFNNoChangeDir

&H8

Forces the dialog box to set the current directory to what it was when the dialog box was opened

OFNNoDereferenceLinks

&H100000

Do not dereference shell links (also known as shortcuts). By default, choosing a shell link causes it to be dereferenced by the shell

OFNNoLongNames

&H40000

No long file names

OFNNoReadOnlyReturn

&H8000

Specifies that the returned file won't have the Read Only attribute set and won't be in a write-protected directory

OFNNoValidate

&H100

Specifies that the common dialog box allows invalid characters in the returned filename

OFNOverwritePrompt

&H2

Causes the Save As dialog box to generate a message box if the selected file already exists. The user must confirm whether to overwrite the file

OFNPathMustExist

&H800

Specifies that the user can enter only valid paths. If this flag is set and the user enters an invalid path, a warning message is displayed

OFNReadOnly

&H1

Causes the Read Only check box to be initially checked when the dialog box is created. This flag also indicates the state of the Read Only check box when the dialog box is closed

OFNShareAware

&H4000

Specifies that sharing violation errors will be ignored

The OFNExplorer and OFNDereferenceLinks flags work only under Windows 95 and Windows NT 4.0. Multiselect common dialogs under Windows 95 using OFNExplorer use null characters for delimiters, but under previous versions of Windows NT without the Windows 95 shell, the multiselect uses spaces for delimiters (thus no support for long filenames).

Under both Windows NT 4.0 and Windows 95 if you do not choose OFNAllowMultiselect, then both the OFNExplorer and OFNLongNames flags have no effect and are essentially the default.

If you use the OFNAllowMultiselect flag by itself under both Windows NT 4.0 and Windows 95, you will not have support for long filenames. This is because the multiple filenames come back space delimited and long filenames could include spaces. You cannot avoid this behavior if you have Windows NT 3.5. If you use OFNAllowMultiselect, you cannot see long filenames. If you add the OFNExplorer flag under Windows 95, you will be able to both multiselect and see long filenames. But the filenames come back null character delimited and not space delimited. Thus, using OFNAllowMultiselect with OFNExplorer will require different parsing of the filename result under Windows 95 and Windows NT 4.0.

 

Print dialog box

Flag

Value

Description

PDAllPages

&H0

Returns or sets the state of the All Pages option button

PDCollate

&H10

Returns or sets the state of the Collate check box

PDDisablePrintToFile

&H80000

Disables the Print To File check box

PDHelpButton

&H800

Causes the dialog box to display the Help button

PDHidePrintToFile

&H100000

Hides the Print To File check box

PDNoPageNums

&H8

Disables the Pages option button and the associated edit control

PDNoSelection

&H4

Disables the Selection option button

PDNoWarning

&H80

Prevents a warning message from being displayed when there is no default printer

PDPageNums

&H2

Returns or sets the state of the Pages option button

PDPrintSetup

&H40

Causes the system to display the Print Setup dialog box rather than the Print dialog box

PDPrintToFile

&H20

Returns or sets the state of the Print To File check box

PDReturnDC

&H100

Returns a device context for the printer selection made in the dialog box. The device context is returned in the dialog box's hDC property

PDReturnDefault

&H400

Returns default printer name

PDReturnIC

&H200

Returns an information context for the printer selection made in the dialog box. An information context provides a fast way to get information about the device without creating a device context. The information context is returned in the dialog box's hDC property

PDSelection

&H1

Returns or sets the state of the Selection option button. If neither PDPageNums nor PDSelection is specified, the All option button is in the selected state

PDUseDevModeCopies

&H40000

If a printer driver doesn't support multiple copies, setting this flag disables the Number of copies spinner control in the Print dialog. If a driver does support multiple copies, setting this flag indicates that the dialog box stores the requested number of copies in the Copies property

 

Color dialog box

Flag

Value

Description

CCFullOpen

&H2

Entire dialog box is displayed, including the Define Custom Colors section

CCHelpButton

&H8

Causes the dialog box to display a Help button

CCPreventFullOpen

&H4

Disables the Define Custom Colors command button and prevents the user from defining custom colors

CCRGBInit

&H1

Sets the initial color value for the dialog box

 

Font dialog box

Flag

Value

Description

CFANSIOnly

&H400

Specifies that the dialog box allows only a selection of the fonts that use the Windows character set. If this flag is set, the user won't be able to select a font that contains only symbols

CFApply

&H200

Enables the Apply button on the dialog box

CFBoth

&H3

Causes the dialog box to list the available printer and screen fonts. The hDC property identifies the device context associated with the printer

CFEffects

&H100

Specifies that the dialog box enables strikethrough, underline, and color effects

CFFixedPitchOnly

&H4000

Specifies that the dialog box selects only fixed-pitch fonts

CFForceFontExist

&H10000

Specifies that an error message box is displayed if the user attempts to select a font or style that doesn't exist

CFHelpButton

&H4

Causes the dialog box to display a Help button

CFLimitSize

&H2000

Specifies that the dialog box selects only font sizes within the range specified by the Min and Max properties

CFNoFaceSel

&H80000

No font name selected

CFNoSimulations

&H1000

Specifies that the dialog box doesn't allow graphic device interface (GDI) font simulations

CFNoSizeSel

&H200000

No font size selected

CFNoStyleSel

&H100000

No style was selected

CFNoVectorFonts

&H800

Specifies that the dialog box doesn't allow vector-font selections

CFPrinterFonts

&H2

Causes the dialog box to list only the fonts supported by the printer, specified by the hDC property

CFScalableOnly

&H20000

Specifies that the dialog box allows only the selection of fonts that can be scaled

CFScreenFonts

&H1

Causes the dialog box to list only the screen fonts supported by the system

CFTTOnly

&H40000

Specifies that the dialog box allows only the selection of TrueType fonts

CFWYSIWYG

&H8000

Specifies that the dialog box allows only the selection of fonts that are available on both the printer and on screen. If this flag is set, the CFBoth and CFScalableOnly flags should also be set