This example uses the WinFreeFileDlgList function to deallocate the table of file name pointers returned by the WinFileDlg function when the field of the FILEDLG structure.

#define INCL_WINSTDFILE  /* Window Standard File Functions       */
#include <os2.h>

BOOL    fSuccess;        /* Success indicator                    */
FILEDLG pfdFiledlg;      /* File dialog info structure           */
HWND    hwndMain;        /* Window that owns the file dialog     */
HWND    hwndDlg;         /* File dialog window                   */

/*****************************************************************/
/* initialize FILEDLG structure                                  */
/*****************************************************************/
pfdFiledlg.cbSize = sizeof(FILEDLG); /* Size of structure        */
pfdFiledlg.fl = FDS_MULTIPLESEL | FDS_HELPBUTTON | FDS_CENTER |
                FDS_OPEN_DIALOG;     /* FDS_* flags              */

/*****************************************************************/
/* Set remaining fields here                                     */
/*****************************************************************/
.
.
.

/*****************************************************************/
/* Display the dialog and get the files                          */
/*****************************************************************/

hwndDlg = WinFileDlg(HWND_DESKTOP, hwndMain, &pfdFiledlg);

if (hwndDlg && (pfdFiledlg.lReturn == DID_OK))
{

   /**************************************************************/
   /* Upon successful return of the files, open them for further */
   /* processing using the table of file name pointers           */
   /**************************************************************/

   /**************************************************************/
   /* Find out whether the pointer array was allocated           */
   /**************************************************************/

   if (pfdFiledlg.papszFQFilename)

      /***********************************************************/
      /* If so, free the table of file name pointers             */
      /***********************************************************/

      fSuccess = WinFreeFileDlgList(pfdFiledlg.papszFQFilename);
}


[Back] [Next]