Standard Dialogs - WinFileDlg() Function
USHORT OpenFile(HWND hOwner)
{
extern PFNWP WinFileDlg(); /* Function prototype */
extern FILEDLG fild; /* File dlg control structure */
extern HFILE hFileToOpen; /* File handle */
extern USHORT usAction; /* Action indicator */
static BOOL fFirstTime = TRUE; /* Flag */
USHORT usReturn; /* Return code */
if (fFirstTime) /* If invoked for first time */
{ /* build control structure */
fild.cbSize = sizeof(FILEDLG); /* Set size of control struct */
fild.fl = FDS_OPEN_DIALOG | /* Set dialog type to "Open" */
FDS_CENTER | /* Centered in parent window */
FDS_HELP_BUTTON; /* Include help button */
fild.pszTitle = NULL; /* Use default title bar text */
fild.pszOKButton = NULL; /* Use default button text */
fild.pfnDlgProc = NULL; /* Use standard dlg proc */
fild.hmod = NULL; /* " " " " */
fild.idDlg = 0; /* " " " " */
fild.pszIType = NULL; /* No initial type setting */
fild.ppszITypeList = NULL; /* No list of types */
fild.pszIDrive = NULL; /* No initial drive setting */
fild.ppszIDriveList = NULL; /* No list of drivers */
fFirstTime = FALSE; /* Set flag to false */
}
WinFileDlg(hOwner, /* Invoke file dialog */
&fild); /* Control structure pointer */
rc = DosOpen(fild.szFullFile, /* Open returned file name */
&hFileToOpen, /* File handle */
&usAction, /* Action indicator */
0L, /* File size not applicable */
0, /* File attribute ignored */
0x0001, /* Open file if it exists */
0x00C2, /* Non-shared, read-write */
0L); /* No sharing mode */
return(rc); /* Return */
}
[Back: Placing a Check Mark on a Pulldown Menu Item]
[Next: WinFontDlg() Function - Sample Code]