| | |
file browser window in a .cpp file
Please support our C++ advertiser: Intel Parallel Studio Home
![]() |
•
•
Join Date: Apr 2008
Posts: 2
Reputation:
Solved Threads: 0
Hi,
I am using visual studio 8 to create an application. I need to incorporate file browser window in a .cpp file. The code i have only browses the folders and sub folders but does not display the individual files. Can anyone help me with this..? Any help would be greatly appreciated. Thanks a lot.
my code is
I am using visual studio 8 to create an application. I need to incorporate file browser window in a .cpp file. The code i have only browses the folders and sub folders but does not display the individual files. Can anyone help me with this..? Any help would be greatly appreciated. Thanks a lot.
my code is
C++ Syntax (Toggle Plain Text)
void BrowseFolder( void ) { TCHAR path[MAX_PATH]; BROWSEINFO bi = { 0 }; bi.lpszTitle = (LPCWSTR)("All Folders Automatically Recursed."); LPITEMIDLIST pidl = SHBrowseForFolder ( &bi ); if ( pidl != 0 ) { SHGetPathFromIDList ( pidl, (LPWSTR)path ); SetCurrentDirectory ( (LPCWSTR)path ); SearchFolder( path ); IMalloc * imalloc = 0; if ( SUCCEEDED( SHGetMalloc ( &imalloc )) ) { imalloc->Free ( pidl ); imalloc->Release ( ); } } } void SearchFolder( TCHAR * path ) { WIN32_FIND_DATA FindFileData; HWND m_listbox_hwnd; HANDLE hFind; TCHAR filename[ MAX_PATH + 256 ]; TCHAR pathbak[ MAX_PATH ]; strcpy( (char *)pathbak, (char *)path ); hFind = FindFirstFile ( (LPCWSTR)"*.*", &FindFileData ); do { if ( hFind != INVALID_HANDLE_VALUE ) { if ( ! ( strcmp( (char *)FindFileData.cFileName, "." ) ) || ! ( strcmp( (char *)FindFileData.cFileName, ".." ) ) ) { continue; } strcpy( (char *)path, (char *)pathbak ); sprintf((char *) path, "%s\\%s", (char *)path, FindFileData.cFileName ); if ( ( SetCurrentDirectory( path ) ) ) { SearchFolder( path ); } SendMessage( m_listbox_hwnd, LB_ADDSTRING, 0, path ); } } while ( FindNextFile ( hFind, &FindFileData ) && hFind != INVALID_HANDLE_VALUE ); FindClose ( hFind ); }
Last edited by Ancient Dragon; Apr 22nd, 2008 at 9:40 am. Reason: replaced icode tags with code tags
•
•
Join Date: Nov 2007
Posts: 979
Reputation:
Solved Threads: 209
Use the BIF_BROWSEINCLUDEFILES flag in the BROWSEINFO's ulFlags member.
http://msdn2.microsoft.com/en-us/lib...05(VS.85).aspx
http://msdn2.microsoft.com/en-us/lib...05(VS.85).aspx
![]() |
Similar Threads
- explorer.exe uses 99% CPU (Viruses, Spyware and other Nasties)
- Open In New Window Php (PHP)
- .EXE, .ZIP, .RAR won't open. (Viruses, Spyware and other Nasties)
- virtumonde.o strikes again (Viruses, Spyware and other Nasties)
- Need help with the Trojan vundo file ... (Viruses, Spyware and other Nasties)
Other Threads in the C++ Forum
- Previous Thread: C++
- Next Thread: How to open a text file and parse out its words?
| Thread Tools | Search this Thread |
Tag cloud for C++
api application array arrays based beginner binary bmp c++ c/c++ calculator char char* class classes code compile compiler console conversion convert count data delete deploy dll dynamiccharacterarray email encryption error file format forms fstream function functions game givemetehcodez graph gui homeworkhelp iamthwee ifstream input int java lib library lines list loop looping loops map math matrix memory newbie news number numbertoword output pointer problem program programming project python random read recursion recursive reference return rpg search simple sorting spoonfeeding string strings struct temperature template templates text text-file tree url variable vector video visual visualstudio void win32 windows winsock wordfrequency wxwidgets






