Jump to content

WinFreeFileDlgList

From EDM2

This function frees the storage allocated by the file dialog when the dialog flag is set.

Syntax

WinFreeFileDlgList(papszFQFilename);

Parameters

papszFQFilename (PAPSZ) - input
Pointer to a table of pointers of fully-qualified file names returned by the dialog.

Returns

rc (BOOL) - returns
Success indicator.
TRUE
Successful completion.
FALSE
Error occurred.

Remarks

When the style flag is set and the user selects one or more files from the file name list box, the fully-qualified file names of the selected files are returned in the field of the FILEDLG structure. After the application retrieves all of the information it needs from the array, it should call WinFreeFileDlgList to free the storage.

Example Code

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);
}

Definition

#define INCL_winstdfile
#include <os2.h>

PAPSZ    papszFQFilename;  /*  Pointer to a table of pointers of fully-qualified file names returned by the dialog. */
BOOL     rc;               /*  Success indicator. */

rc = WinFreeFileDlgList(papszFQFilename);