To present a file dialog to users, your application must do the following:
Allocate storage for a FILEDLG data structure
and set all fields to NULL.
Initialize the fields in the FILEDLG data structure.
The application must do the following:
a.
Set the cbSize field to the size of the
data structure.
b.
Set the
fl field to indicate the type of dialog. You must set the FDS_OPEN_DIALOG
or FDS_SAVEAS_DIALOG flags.
The application can
set the following:
a.
An application-specific title. Pass the pointer
to a null-terminated string in the pszTitle field.
b.
An application-specific text for the OK push
button. Pass the pointer to a null-terminated string in the pszOKButton
field.
c.
A custom dialog
procedure to provide application-specific function. Pass the pointer to
a window procedure in the pfnDlgProc field.
d.
Set other FDS_* flags in the fl field to
customize the dialog style.
e.
Pass
the initial position of the dialog in the x and y fields.
3.
Initialize
the FILEDLG data structure with any values that users should see when they
invoke the dialog for the first time. For example, you can:
a.
Pass the name of the first drive from which file
information will be displayed in the pszIDrive field.
b.
If you want to limit user selections, pass a list
of drives from which the user can choose in the papszIDriveList field.
Otherwise, the system defaults to showing all available drives.
c.
Pass the name of an extended-attribute filter
to be used to filter file information in the pszIType field.
d.
Pass a list of extended attributes in the papszITypeList
field. By selecting from this list, users can filter file information.
e.
Pass the name of the
initial file to be used by the dialog in the szFullFile field. This
can be a file name or a string filter, such as *.dat, to filter the initial
file information. This field can be fully qualified to select the initial
drive and directory.
4.
Invoke
the file dialog. Call WinFileDlg and pass the dialog's owner window handle
and a pointer to the initialized FILEDLG data structure.
5.
Verify the return value from WinFileDlg. If it
is successful, the application can create the file dialog (either Open or
SaveAs) by using the file name or file names returned from the dialog.