If you want a user to be able to select multiple files from Windows, create a new form and from the VFP menu :-
Tools > Component Gallery > Foundation Classes > Dialogs > Common Dialog (then right click) > Add to Form
Rename the class to .cusCommonDialog.
As you will discover, there are numerous properties and methods for this class. It combines GETFILE(), PUTFILE() and presents a modern interface to the user.
The following example sets the relevant properties to enable multiple file selection, shows the dialog and displays the path\filename.ext of the selected files in a cursor. CREA CURS FILENAMES (filename C(254))
WITH THISFORM.cusCommonDialog .ClearFilters() && Clear filters in case in loop .lAllowMultiSelect = .T. && Enable multiple file selection .cFileName =  && Do not set an initial file name .cInitialDirectory = [C:\My Documents] && Start folder .cTitlebarText = [Select multiple files] && Dialog titlebar text .aFilterList[1,1] = [Image Files (bmp,gif,jpg)] && First half of filter list .aFilterList[1,2] = [*.bmp;*.gif;*.jpg;*.jpeg] && Second half of filter list * Should you want additional filters you can add them with :- .AddFilter([MS Office (doc,ppt,rtf,txt,wri,xls)],[*.doc;*.ppt;*.rtf;*.txt;*.wri;*.xls]) .nFileCount = 0 && Reset file count value in case dialog in DO WHILE... loop .ShowDialog() && Show dialog
IF .nFileCount > 0 && File(s) selected FOR i = 1 TO ALEN(.aFileNames,1) && Loop through array created INSERT INTO FILENAMES (filename) VALUES ( ; ADDBS(.cFilepath) ; + LOWER(.aFileNames[1,i])) && Insert path\filename.ext in cursor ENDF BROW LAST ELSE MESSAGEBOX([You have not made a selection],16,[No files],2000) ENDI ENDW
If you have OLE drag 'n drop enabled on a form control, you can also drag and drop multiple files from the Windows Common dialog onto your VFP control.
You then need to ensure that you release the Windows Common dialog in the .OLEDragDrop() event of the VFP control to avoid a recursive call to the Windows Common dialog.
Put the following code into the .OLEDragDrop() event:- DECLARE INTEGER FindWindow IN WIN32API ; STRING cNull,; STRING cWinName
DECLARE LONG PostMessage IN WIN32API ; LONG hWnd ,; LONG wMsg ,; LONG wParam ,; LONG lParam
lcWindowTitle = ALLTRIM(THISFORM.cusCommonDialog.cTitleBarText) IF lcWindowTitle = [Select multiple files] ** If the file was 'dropped' by the Windows Common Dialog box, close that dialog. lnHWnd = FindWindow(NULL,lcWindowTitle) IF lnHWnd # 0 PostMessage(lnHWnd,WM_CLOSE,0,0) ENDIF ENDIF
There is far more depth to this class than can be demonstrated in a single FAQ - get coding and have fun!