This example uses WinFileDlg to create and display a single file selection dialog using the system default open file dialog template and procedure.
#define INCL_WINSTDFILE /* Window Standard File */ /* functions */ #include <os2.h> FILEDLG fild; /* File dialog info structure */ char pszTitle[10] = "Open File"; /* Title of dialog */ char pszFullFile[CCHMAXPATH] = "*.C"; /* File filter string */ HWND hwndMain; /* Window that owns the file */ /* dialog */ HWND hwndDlg; /* File dialog window */ /* Initially set all fields to 0 */ memset(&pfdFiledlg, 0, sizeof(FILEDLG)); /* Initialize those fields in the FILEDLG structure */ /* that are used by the application */ fild.cbSize = sizeof(FILEDLG); /* Size of structure */ fild.fl = FDS_HELPBUTTON | /* FDS_* flags */ FDS_CENTER | FDS_OPEN_DIALOG; fild.pszTitle = pszTitle; /* Dialog title string */ /* Initial path, file name, or file filter */ strcpy(fild.szFullFile, pszFullFile); /* Display the dialog and get the file */ hwndDlg = WinFileDlg(HWND_DESKTOP, hwndMain, &fild); if (hwndDlg && (pfild.lReturn == DID_OK)) { /* Upon successful return of a file, open it for reading */ /* and further processing */ }