-
February 19th, 2004, 04:26 AM
#1
Creating a directory selection dialog
Hello,
does anybody know how to create a dialog, similar to File Open or Save As dialogs, that would enable me to select a directory? I need a dialog where the user could choose a directory into which the output files of the application will be saved. I suppose such dialog should be possible to create by setting some parameters in the CFileDialog::CFileDialog() constructor. Anyway, I tried searching the MSDN and haven't found anything yet.
thanks for your answer,
Koxin
-
February 19th, 2004, 04:32 AM
#2
use this...
Code:
if ( <Object Of this class>.GetFolder(<string to receive which folder is selected>, "Any string.", this->m_hWnd, NULL, NULL))
{
if (!<string to receive which folder is selected>.IsEmpty())
{
Thats how you can use it. Have fun
-
February 19th, 2004, 04:32 AM
#3
herez the code which will let u do that
Code:
if (::SHGetPathFromIDList(lpItemIDList, szBuffer))
{
// At this point, szBuffer contains the path
// the user chose.
if (szBuffer[0] == '\0')
{
// SHGetPathFromIDList failed, or
// SHBrowseForFolder failed.
AfxMessageBox(IDP_FAILED_GET_DIRECTORY,
MB_ICONSTOP|MB_OK);
return strResult;
}
// We have a path in szBuffer!
// Return it.
strResult = szBuffer;
return strResult;
}
else
{
// The thing referred to by lpItemIDList
// might not have been a file system object.
// For whatever reason, SHGetPathFromIDList
// didn't work!
AfxMessageBox(IDP_FAILED_GET_DIRECTORY,
MB_ICONSTOP|MB_OK);
return strResult; // strResult is empty
}
nd if u need documentation search for "browse for folder non-com way"
string in MSDN library. It will give u watever u require.
"I came"
"I saw"
"I conquered"
-
February 19th, 2004, 04:33 AM
#4
oops m late by few secs
"I came"
"I saw"
"I conquered"
-
February 19th, 2004, 05:19 AM
#5
doesn't make a difference, its not a competition man
have fun...
-
February 19th, 2004, 10:04 AM
#6
Works perfectly
thanks agin guys!!!!!!
Koxin
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|