Admin Production ni-theme
Current Publication

GetFilePopupDirHistory

LabWindows/CVI

GetFilePopupDirHistory

int GetFilePopupDirHistory (int *numberOfDirectories, char ***directoryList);

Purpose

Returns the entries from one of the following lists depending on the function you use in conjunction with the GetFilePopupDirHistory function:

  • Previous locations list that appears in the dialog boxes you can display with the FileSelectPopupEx, MultiFileSelectPopupEx, and DirSelectPopupEx functions.
    Note Note  In addition to directories you add programmatically to the Previous locations list using the AddToFilePopupDirHistory function, directories selected by the user in another application's common item dialog might also appear in the Previous locations list. The GetFilePopupDirHistory function only returns the directories added using the AddToFilePopupDirHistory function.
  • Directory history list that appears in the dialog boxes you can display with the FileSelectPopup, MultiFileSelectPopup, or DirSelectPopup functions.

Parameters

Output
Name Type Description
numberOfDirectories int The number of directories in the Previous locations list or directory history list.

You can pass NULL for this parameter.
directoryList char ** An array of strings, where each string is the name of a directory in the Previous locations list or directory history list. The last element of the array is a NULL pointer.

The array is allocated dynamically, as well as each string. When you no longer need them, use the freefree function to free each string and then free the array.

char **dirList = NULL, **ppc = NULL;
int numDirs;
int status;
int i;

status = GetFilePopupDirHistory (&numDirs, &dirList);

if (status >= 0) {
   if (dirList) {
     /* Using for loop to iterate through the directories */
     for (i=0; i < numDirs; ++i) {
       printf ("Dir %d : %s\n", i+1, dirList [i]);
       free (dirList [i]);
       dirList [i] = NULL;
     }
     /* Instead of for loop, can also do
     ppc = dirList;
     while (*ppc) {
       printf ("Dir : %s\n", *ppc);
       free (*ppc);
       *ppc = NULL;
       ppc++;
     }
     */
     free (dirList);
     dirList = NULL;
   }
}

Return Value

Name Type Description
status int Return value indicating whether the function was successful. A negative number indicates that an error occurred.

Additional Information

Library: User Interface Library

Include file: userint.h

LabWindows/CVI compatibility: LabWindows/CVI 6.0 and later