GetFileNameFromBrowse function
[This function is available through Windows XP Service Pack 2 (SP2) and Windows Server 2003. It might be altered or unavailable in subsequent versions of Windows.]
Creates an Open dialog box so that the user can specify the drive, directory, and name of a file to open.
Syntax
BOOL GetFileNameFromBrowse( _In_opt_ HWND hwnd, _Inout_ PWSTR pszFilePath, UINT cchFilePath, _In_opt_ PCWSTR pszWorkingDir, _In_ PCWSTR pszDefExt, _In_opt_ PCWSTR pszFilters, _In_opt_ PCWSTR szTitle );
Parameters
- hwnd [in, optional]
-
Type: HWND
A handle to the window that owns the dialog box. This member can be any valid window handle, or it can be NULL if the dialog box has no owner.
- pszFilePath [in, out]
-
Type: PWSTR
A null-terminated Unicode string that contains a file name used to initialize the File Name edit control. This string corresponds to the OPENFILENAME structure's lpstrFile member and is used in exactly the same way.
- cchFilePath
-
Type: UINT
The number of characters in pszFilePath, including the terminating null character.
- pszWorkingDir [in, optional]
-
Type: PCWSTR
The fully qualified file path of the initial directory. This string corresponds to the OPENFILENAME structure's lpstrInitialDir member and is used in exactly the same way.
- pszDefExt [in]
-
Type: PCWSTR
A null-terminated Unicode string that contains the default file name extension. This extension is added to pszFilePath if the user does not specify an extension. The string should not contain any '.' characters. If this string is NULL and the user fails to type an extension, no extension is appended.
- pszFilters [in, optional]
-
Type: PCWSTR
A null-terminated Unicode string that defines the filter. This string corresponds to the OPENFILENAME structure's lpstrFilter member and is used in exactly the same way.
- szTitle [in, optional]
-
Type: PCWSTR
A null-terminated Unicode string that is placed in the title bar of the dialog box. If this value is NULL, the system uses the default title.
Return value
Type: BOOL
If the user specifies a file name and clicks OK, the return value is TRUE. The buffer that pszFilePath points to contains the full path and file name that the user specifies. If the user cancels or closes the Open dialog box or an error occurs, the return value is FALSE.
Requirements
|
Minimum supported client |
Windows 2000 Professional [desktop apps only] |
|---|---|
|
Minimum supported server |
Windows 2000 Server [desktop apps only] |
|
Header |
|
|
Library |
|
|
DLL |
|
See also