CommDlg Ocx

Purpose

The CommDlg Ocx provides a standard set of dialog boxes for operations such as opening and saving files, setting print options, and selecting colors and fonts. The control also has the ability to display help.

Syntax

CommDlg

Description

The CommDlg object provides an interface to the routines in the Microsoft Windows dynamic-link library Commdlg.dll.

You use the CommDlg object in your application by adding it to a form and setting its properties. In code a CommDlg object is created using the Ocx command or the As New clause in a Dim statement.

Ocx CommDlg cd

Dim cd As New CommDlg

The dialog displayed by the Ocx control is determined by the methods of the control. The CommDlg object can display the following dialogs using the specified method.

ShowOpen Show Open Dialog Box
ShowSave Show Save As Dialog Box
ShowColor Show Color Dialog Box
ShowFont Show Font Dialog Box
ShowPageSetup Show Page Setup Dialog Box
ShowPrint Show Print or Print Options Dialog Box
ShowHelp Invokes the Windows Help Engine
ShowFolders Show Browse for Folders Dialog Box

There is no way to specify where a dialog box is displayed except if you wish it centred over the owning form, when you can use the DlgCenter[Hook] command.

.

Properties

CancelError | Color | Colors | DefExt | DevNames | Enabled | FileName | FileTitle | Filter | FilterIndex | Flags | Font | FontBold | FontItalic | FontStrikethru | FontUnderline | FontName | FontSize | FromPage | hDC | HelpCommand | HelpContext | HelpFile | HelpKey | IniDir | Left | Max | Min | Name | Parent | pgBottom | pgLeft | pgMinBottom | pgMinLeft | pgMinRight | pgMinRight | pgMinTop | pgScale | pgTop | PointSize | Tag | Title | Top | ToPage

Methods

AboutBox | ShowColor | ShowFolders | ShowFont | ShowHelp | ShowOpen | ShowPageSetup | ShowPrint | ShowSave

Events

OnHelp

Syntax:

Sub CommDlg_OnHelp

Occurs when the user selects the Help button on the common dialog box. The Help button is displayed if the Flags property includes the Help button flag bit.

Example

Ocx CommDlg cd

cd.Flags = cdfSHowHelp

cd.ShowFont

Sub cd_OnHelp

MsgBox "Help clicked"

EndSub

See Also

DlgCenter, DlgCenterHook, Dlg Open, Dlg Save, Dlg Color, Dlg Font, Dlg Print, SplitPath.

Ocx, OcxOcx

Animation, CheckBox, ComboBox, Command, Form, Frame, Image, ImageList, Label, ListBox, ListView, MonthView, Option, ProgressBar, RichEdit, Scroll, Slider, StatusBar, TabStrip, TextBox, Timer, TrayIcon, TreeView, UpDown

{Created by Sjouke Hamstra; Last updated: 23/02/2022 by James Gaite}