|
Overview |
|
|
|
Group |
|
|
|
Quick Info
Windows NT
| Yes
| Win95
| Yes
| Win32s
| Yes
| Import Library
| comdlg32.lib
| Header File
| commdlg.h
| Unicode
| WinNT
| Platform Notes
| None
|
|
|
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.
BOOL GetOpenFileName(
LPOPENFILENAME lpofn
| // address of structure with initialization data
| );
|
|
Parameters
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
|
Remarks
By default, Windows 95 and Windows NT version 4.0 display a new version of the
Open dialog box that provides user-interface features that are similar to the
Windows Explorer. You can provide an OFNHookProc hook procedure for an Explorer-style Open dialog box. To enable the hook
procedure, set the OFN_EXPLORER and OFN_ENABLEHOOK flags in the Flags member of the OPENFILENAME structure and specify the address of the hook procedure in the lpfnHook member.
Windows 95 and Windows NT 4.0 continue to support the old-style Open dialog
box for applications that want to maintain a user-interface consistent with the
Windows 3.1 or Windows NT 3.51 user-interface. To display the old-style Open
dialog box, enable an OFNHookProcOldStyle hook procedure and ensure that the OFN_EXPLORER flag is not set.
See Also
CommDlgExtendedError, GetSaveFileName, OFNHookProc , OFNHookProcOldStyle, OPENFILENAME
Related Links
Software for Delphi and C++ Builder developers
Software for Visual Studio .NET developers
Software for Visual Basic 6 developers
Delphi Tips&Tricks
MegaDetailed.NET
TMS Scripter Studio Pro components for Delphi/C++Builder
More Online Helps
Win32 Multimedia Programmer's Reference (mmedia.hlp)
OLE Programmer's Reference (ole.hlp)
Microsoft Windows Pen API Programmer's Reference (penapi.hlp)
Microsoft Windows Sockets 2 Reference (sock2.hlp)
Microsoft Windows Telephony API (TAPI) Programmer's Reference (tapi.hlp)
Unix Manual Pages
|