Hi,
There is a complicated example in the Sample CVI files (I can't
remember the exact path). However, I have successfully used the 'List'
functions (either toolbox or utility functions as I recall) to
implement a recent files list, after a fashion. The basic idea
was as follows:
struct MenuList
{
ListType FilePathList; // full file path
ListType FileMenuList; // abbreviated path for display on menu
ListType FileMenuID;
// identifier for each menu entry of full and abbreviated
paths
} RFL;
char pathname[MAX_FILENAME_LEN], display_path[MAX_PATHNAME_LEN];
int entry_ID;
static int prev_entry_ID; // (use ListGetItem for this)
// Break up 'pathname' using pointer manipulation, strcpy, strstr, strcat, or strtok, etc. e.g. C:\Data...\test.dat
....
// add to menu and assign a custom callback function (e.g.
'OpenRecentFile'), which uses RFL structure for information on path...
entry_ID = NewMenuItem (Menubar, MenuID, display_path, prev_entry_ID, 0, OpenRecentFile, RFL);
SetMenuBarAttribute (Menubar, entry_ID, ATTR_CHECKED, TRUE); // optional check mark
Then use...
ListInsertItem (RFL.FilePathList, pathname, FRONT_OF_LIST);
ListInsertItem (RFL.FileMenuList, display_path,
FRONT_OF_LIST);
ListInsertItem (RFL.FileMenuID, &entry_ID, FRONT_OF_LIST);
I also used ListGetPtrToItem, ListNumItems, ListInsertItem
and ListRemoveItem. If you read the help info for these, their
application should make sense. 'Normal' windows-based
applications save their recent file list in the Windows registry, but I
avoided this by simply
writing all strings to a text file in the application's directory.
(much simpler and safer for apps that may not be installed with an
installation program!)
John.