CFolderPickerDialog Introduction Chinese translates to "folder Pickup dialog". This is the newly introduced class for the folder selection dialog box in Visual C + + 2008, which replaces the traditional SDK approach and has a better look. However, This class is only available for Vista and above Windows operating systems. header file: Afxdlgs.h Example constructor: CFolderPickerDialog (LPCTSTR lpszfolder = NULL, DWORD dwFlags = 0, cwnd* pParentWnd = NULL, DWORD dwsize = 0); Example: CFolderPickerDialog fd (null,0,this,0); int RET=FD. DoModal (); if (Ret==idok) {CString des;des=fd. GetFolderPath ();} The following are implemented with the win API: Browseinfo Bi;char path[max_path];char title[] = "Select Directory"; ZeroMemory (&bi,sizeof (BI)); bi.hwndowner = This->m_hwnd;bi.pszdisplayname = Path;bi.lpsztitle = title; Bi.ulflags = 0x0040; CString dir; Lpitemidlist list = SHBrowseForFolder (&bi), if (list = = NULL) dir = ""; else{shgetpathfromidlist (List,path);d ir. Format ("%s", path); This API version applies not only to XP systems, but also to Vista and Win7 systems. But the appearance of the interface is different.
VC Select Directory with dialog box: CFolderPickerDialog (VS2008 and later version)