A | B | C |  D | E | F |  G | H | I |  J | K | L |  M | N | O |  P | Q | R |  S | T | U |  V | W | X |  Y | Z



GetOpenFileName

The GetOpenFileName function creates an Open common dialog box that lets the user specify the drive, directory, and the name of a file or set of files to open.

VB4-32,5,6
Declare Function GetOpenFileName Lib "comdlg32.dll" Alias "GetOpenFileNameA" (pOpenfilename As OPENFILENAME) As Long

VB.NET
System.Windows.Forms.OpenFileDialog

Operating Systems Supported
Requires Windows NT 3.1 or later; Requires Windows 95 or later

Library
Comdlg32

Parameter Information
lpofn
Pointer to an OPENFILENAME structure that contains information used to initialize the dialog box. When GetOpenFileName returns, this structure contains information about the user’s file selection.

Return Values
If the user specifies a filename and clicks the OK button, the return value is nonzero. The buffer pointed to by the lpstrFile member of the OPENFILENAME structure contains the full path and filename specified by the user.

If the user cancels or closes the Open dialog box or an error occurs, the return value is zero. To get extended error information, call the CommDlgExtendedError function, which can return one of the following values:
CDERR_FINDRESFAILURE, CDERR_NOHINSTANCE, CDERR_INITIALIZATION, CDERR_NOHOOK, CDERR_LOCKRESFAILURE, CDERR_NOTEMPLATE, CDERR_LOADRESFAILURE, CDERR_STRUCTSIZE, CDERR_LOADSTRFAILURE, FNERR_BUFFERTOOSMALL, CDERR_MEMALLOCFAILURE, FNERR_INVALIDFILENAME, CDERR_MEMLOCKFAILURE, FNERR_SUBCLASSFAILURE

Last update: 07 April 2006