DO CASE CASE EMPTY(lcFileList) USE IN SELECT([FILENAMES]) CASE OCCURS(CHR(0),lcFileList) = 0 INSERT INTO FILENAMES (filename) VALUES (lcFileList) OTHERWISE FOR i = 0 TO OCCURS(CHR(0),lcFileList) IF i = 0 lcPath = SUBSTR(lcFileList,1,AT(CHR(0),lcFileList)) lcFileList = SUBSTR(lcFileList,AT(CHR(0),lcFileList) + 1) ELSE IF CHR(0) $ lcFileList lcFileName = SUBSTR(lcFileList,1,AT(CHR(0),lcFileList)) lcFileList = SUBSTR(lcFileList,AT(CHR(0),lcFileList) + 1) ELSE lcFileName = lcFileList ENDI INSERT INTO FILENAMES ; (filename); VALUES ; (ADDBS(lcPath) + lcFileName) ENDIF ENDFOR ENDCASE
SET DEFA TO (lcCurDir)
The use of the BITOR() function is an alternative to adding the desired constant values together to determine the .Flags value, which in turn determines the behaviour of the common dialog.
Documentation may be found here, and there may well be better documentation elsewhere.
It's relatively simple to change the behaviour of the common dialog by adding or removing parameters to suit.
Other properties will also need modifying to suit your particular project.
The dialog will now appear wherever you have determined the form would have shown and the dialog will have the icon of your choice.
Unless the user cancelled out, the barebones code example will populate a cursor FILENAMES with the path\filename.ext of a single selected file or path\filename.ext of multiple selected files.