Microsoft Common Dialog Control

from HTYP, the free directory anyone can edit if they can prove to me that they're not a spambot
Jump to navigation Jump to search

Overview

The Microsoft Common Dialog Control, shown as MSComDlg in an ActiveX browser, provides an API for many of the standard dialog boxes used in Microsoft Windows.

It is, however, not very well documented, and the ActiveX interface does not display the names of some of the crucial identifiers.

Usage

When you create a control of this type, the actual properties and methods are accessed via "ControlName.Object.MemberName".

Properties

  • .Filter: a delimited text string which specifies the filename filters to apply when displaying the file listing. The format is semicolons.
  • .FileName: returns the name(s) of the file(s) selected. If a single file was selected, it returns the filespec. If multiple files were selected, then it is a demarcated list within a single string; items are separated by a null character (Chr(0)):
    • The first item is the full path to the directory occupied by the selected files
    • Each subsequent item is a filename only, no path

Formats

.Filter

description|mask[|description|mask...]"
  • Mask can be either a single wildcarded filemask (as used in DOS directory listings) or a list of masks separated by semicolons.

Examples

<vb> Me.axCmnDlg.Object.Filter = "All Files (*.*)|*.*|Web Image Files (png/jpg/gif)|*.png;*.jpg;*.jpeg;*.gif" </vb>