[方法一]
#include #pragma link "vclx.lib " //if compiler error add this line
UnicodeString dir; //BCB 2009之後要用 UnicodeString
if( SelectDirectory("選擇目錄", " ", dir)) { ShowMessage(dir) ; }
[方法二]
#include
#define NO_WIN32_LEAN_AND_MEAN #include #include
String WorkDir;
BROWSEINFO bi; char WDir[MAX_PATH]; char FolderName[MAX_PATH]; LPITEMIDLIST ItemID; memset(&bi, 0, sizeof(BROWSEINFO)); memset(WDir, 0, MAX_PATH); bi.hwndOwner = Handle; bi.pszDisplayName = FolderName; bi.lpszTitle = "請選擇路徑"; ItemID = SHBrowseForFolder(&bi); SHGetPathFromIDList(ItemID, WDir); WorkDir = String(WDir); |
留言
張貼留言