char lpBuffer[MAX_PATH], buf[1024]; LPMALLOC pMalloc; SHGetMalloc(&pMalloc); BROWSEINFO bi; int i = 0; LPITEMIDLIST pidlBrowse; // PIDL selected by user memset(lpBuffer, 0, sizeof(lpBuffer)); memset(buf, 0, sizeof(buf)); // Fill in the BROWSEINFO structure. bi.hwndOwner = m_hWnd; bi.pidlRoot = NULL; bi.pszDisplayName = lpBuffer; bi.lpszTitle = "选择HTML文件存放的目录"; bi.ulFlags = 0; bi.lpfn = NULL; bi.lParam = 0; // Browse for a folder and return its PIDL. pidlBrowse = SHBrowseForFolder(&bi); if (pidlBrowse != NULL) { // Show the display name, title, and file system path. if (SHGetPathFromIDList(pidlBrowse, lpBuffer)) //you got the path here // Free the PIDL returned by SHBrowseForFolder. pMalloc->Free(pidlBrowse); }
如何弹出系统文件夹选择对话框!
最新推荐文章于 2022-01-21 17:53:12 发布