In VC programming, there are many places to use the folder browsing dialog box, in the Version 5.0 version (Microsoft control version, usually before Windows2000), if you want to add a new folder button on the folder browsing dialog, you need I have programmed it myself. Now you can only set a parameter after Version5.0, and there is a context menu. As shown in the figure below: (Click here to download the entire sample project, this project can be used in your own program. This project can also be used as an initiator's tutorial, the general textbook is very small to talk about the usage of the public dialog box. .)
The main code in the sample project is as follows:
Void cpathtestdlg :: onbuttonbrowse ()
{
CString Str;
Browseinfo Bi;
Char name [MAX_PATH];
ZeromeMory (& Bi, Sizeof (BrowseInfo);
bi.hwndowner = getsafehwnd ();
bi.pszdisplayName = name;
bi.lpsztitle = "select folder";
Bi.ulflags = 80;
LPITEMIDLIST IDL = SHBROWSEFORFOLDER (& BI);
IF (idl == null)
Return;
SHGETPATHFROMIDLIST (IDL, Str.GetBuffer);
Str.releaseBuffer ();
m_strsavepath = STR;
IF (str.getause (Str.getLength () - 1)! = '//')
m_strsavepath = "//";
Updatedata (FALSE);
}
Where bi.ulflags is the format of the dialog, display different styles of dialog box by selecting different parameters.