SHBrowseForFolder如何设定初始目录

char gszRootDir[MAX_PATH] ; int CALLBACK BrowseCallbackProc(HWND hwnd, UINT msg, LPARAM lp, LPARAM Data) { if (msg == BFFM_INITIALIZED ) { ::SendMessage(hwnd,BFFM_SETSELECTION,TRUE,(LPARAM)gszRootDir); } return 0; } BOOL BrowseDirectory(HWND hwnd, LPSTR lpszDir) { lstrcpyn(gszRootDir, lpszDir, sizeof(gszRootDir)) ; BROWSEINFO bi; bi.hwndOwner=hwnd; bi.pidlRoot=0; bi.pszDisplayName=0; bi.lpszTitle="Browse Directory"; bi.lpfn=BrowseCallbackProc; bi.lParam=0; bi.ulFlags= BIF_STATUSTEXT | BIF_USENEWUI | BIF_RETURNONLYFSDIRS; LPITEMIDLIST pidl ; if (pidl = SHBrowseForFolder(&bi)) { SHGetPathFromIDList(pidl, lpszDir); return TRUE ; } return FALSE ; }  

你可能感兴趣的:(BI,Path,callback)