描述:
这个函数可以让用户选择路径,但是好像没有地方设置可以实现上面的功能,请问有没有办法做到呢?
解决方案1:
#include <windows.h>
#include <string.h>
//This is needed for virtually
//everything in BrowseFolder.
#include <shlobj.h>
//BROWSE FOLDER - Opens a browse folder dialog.
void BrowseFolder( void )
{
TCHAR path[MAX_PATH];
BROWSEINFO bi = { 0 };
bi.lpszTitle = ("All Folders Automatically Recursed.");
LPITEMIDLIST pidl = SHBrowseForFolder ( &bi );
if ( pidl != 0 )
{
// get the name of the folder and put it in path
SHGetPathFromIDList ( pidl, path );
//Set the current directory to path
SetCurrentDirectory ( path );
//Begin the search
SearchFolder( path );
// free memory used
IMalloc * imalloc = 0;
if ( SUCCEEDED( SHGetMalloc ( &imalloc )) )
{
imalloc->Free ( pidl );
imalloc->Release ( );
}
}
}//BROWSE FOLDER