VC Select Directory with dialog box: CFolderPickerDialog (VS2008 and later version)

Source: Internet
Author: User
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)

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.