Flags Property (File Dialogs) Example, Common Dialog Control

The example displays an Open dialog box when the user clicks the form.  The dialog box contains a Help button.  The dialog box's Read Only check box is not displayed.  When the user selects the Help button, WINHELP.EXE is executed and displays the topic for the MouseDown event.

Sub Form_Click ()
  Const HELP_KEY = &h0101
  Const OFN_SHOWHELP = &h00000010&
  Const OFN_HIDEREADONLY = &h00000004&

  CMDialog1.HelpFile = "VB.HLP"          ' Set Help properties.
  CMDialog1.HelpCommand = HELP_KEY
  CMDialog1.HelpKey = "MouseDown"

  ' Set flag to display the dialog with a Help button.
  CMDialog1.Flags = OFN_SHOWHELP Or OFN_HIDEREADONLY
  CMDialog1.Action = 1                   ' Display Open dialog.
End Sub