Retrieves the current directory for a directory-selection dialog box.
BOOL GetCommDlgDir(
HWND hDlg,
LPWSTR lpPath,
int nSize
);
hDlg
: A handle to the dialog box.
lpPath
: A pointer to a null-terminated string that receives the full path of the current directory.
nSize
: The size, in characters, of the buffer pointed to by lpPath
.
GetLastError
.The GetCommDlgDir
function is used to retrieve the current directory from a directory-selection dialog box that was created using the ChooseDir
function.
This function is part of the COMdlg32.dll library, which provides common dialog box functionality.
The lpPath
buffer must be large enough to hold the null-terminated string representing the directory path, including the null terminator. The nSize
parameter specifies the total size of this buffer.
Before calling GetCommDlgDir
, you should ensure that the dialog box handle (hDlg
) is valid and that the dialog box is currently active.
Minimum supported client | Windows 2000 Professional |
Minimum supported server | Windows 2000 Server |
Header | CommDlg.h |
Library | Comdlg32.lib |
DLL | Comdlg32.dll |
Unicode and ANSI versions | GetCommDlgDirW (Unicode) and GetCommDlgDirA (ANSI) |