Retro video games delivered to your door every month!
Click above to get retro games delivered to your door ever month!
X-Hacker.org- The Guide to Clip-4-Win version 3.0 - <b>getopenfilename()</b> http://www.X-Hacker.org [<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]
GetOpenFileName()
Get the name of a file to open from a dialog with the user
------------------------------------------------------------------------------

Syntax
GetOpenFileName( <hWnd>, <cFile>, [ <cTitle> ], [ <aFilter> ], [ <nFlags> ],
                 [ <cPath> ], [ <cDefExt> ] )  -->  cFileName

Arguments
<hWnd> is the handle of the window to be the parent (owner) of
the dialog.

<cFile> is a wildcard specification to search for.

<cTitle> is an optional string specifying the title of the
dialog box.

<aFilter> is an optional array of sub-arrays specifying a
series of wildcard file names the user can easily choose from.
Each sub-array is of the form
{ <cDescription>, <cWildcardList> }  where <cDescription> is a
string describing the <cWildcardList>, and <cWildcardList> is
a list of wild-card file names separated by semi-colons.

<nFlags> is an optional numeric used to control the dialog (a
combination of the  OFN_* values defined in commdlg.ch,
although you are very unlikely to use these).  The default is
OFN_FILEMUSTEXIST.

<cPath> is an optional string specifying the default
directory.

<cDefExt> is an optional string specifying the default
filename extension to use.

Returns
If successful, the filename chosen by the user is returned.
If an error occurs or the user cancels the dialog, NIL is
returned.

Description
This function displays a dialog box to assist the user in
specifying a filename to be opened by the application.

(This function uses the familiar Open common dialog.)

Example
aFilter = { { "programs", "*.exe;*.com;*.bat" },  ;
            { "source", "*.c;*.prg" } }
cFile = GetOpenFileName( hWnd, "*.txt", "Select a file", aFilter )
if cFile != nil
     .
     .    // do something with cFile
     .
endif


See Also: GetPrintDC() GetSaveFileName()

Online resources provided by: http://www.X-Hacker.org --- NG 2 HTML conversion by Dave Pearson