IShellFolder浏览文件夹
来源:互联网 发布:114g网站源码 编辑:程序博客网 时间:2024/05/24 02:38
这是由IShellFolder接口提供的浏览文件夹功能:
void SpecialFolder_Browse(HWND hwnd){LPMALLOC g_pMalloc;/* Gets the Shell's default allocator */if (::SHGetMalloc(&g_pMalloc) == NOERROR){BROWSEINFO bi; LPTSTR lpBuffer;LPITEMIDLIST pidlSpecialFolder; // PIDL for Special FolderLPITEMIDLIST pidlBrowse; // PIDL selected by user // Allocate a buffer to receive browse information. if ((lpBuffer = (LPTSTR) g_pMalloc->Alloc(MAX_PATH)) != NULL) { // Get the PIDL for the Programs folder. if (SUCCEEDED(SHGetSpecialFolderLocation(hwnd, CSIDL_DESKTOP/*CSIDL_DESKTOPDIRECTORY*/ , &pidlSpecialFolder))){ // Fill in the BROWSEINFO structure. bi.hwndOwner = hwnd; bi.pidlRoot = pidlSpecialFolder; bi.pszDisplayName = lpBuffer; bi.lpszTitle = _T("Choose a Program Group"); 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. ::MessageBox(hwnd, lpBuffer, L"Display name", MB_OK); if (SHGetPathFromIDList(pidlBrowse, lpBuffer)) //SHGetPathFromIDList获得pidlBrowse的全路径保存在缓存中 MessageBox(lpBuffer); // Free the PIDL returned by SHBrowseForFolder. g_pMalloc->Free(pidlBrowse); } // Clean up. g_pMalloc->Free(pidlSpecialFolder); }g_pMalloc->Free(lpBuffer); }// Release the shell's allocator.g_pMalloc->Release();}}
原文链接:http://blog.csdn.net/zgl7903/article/details/2577729
- IShellFolder浏览文件夹
- IShellFolder 接口浏览文件夹(一)
- 浏览文件夹
- 浏览文件夹
- 文件夹浏览
- 浏览文件夹
- 文件夹浏览
- VC++浏览文件夹
- Delphi浏览文件夹
- "浏览文件夹"选择对话框
- 文件夹浏览对话框类
- EVC浏览文件夹对话框
- 树形控件--浏览文件夹
- 创建浏览文件夹对话框
- 实现浏览文件夹功能
- 文件夹浏览(SHBrowseForFolder)
- 文件夹浏览--Folder
- 创建浏览文件夹对话框 .
- NSDictionary to NSArray
- MYSQL常用字符处理函数问题
- LINUX同步聊天小程序
- android 视频通话 项目 源码
- 一网打尽18种主流数据库:12种SQL+6种NoSQL
- IShellFolder浏览文件夹
- 调用Java NIO提高文件读写速度(1)
- struts.xml文件的配置说明
- linux异步聊天小程序
- javax.naming.NoInitialContextException 错误的解决办法
- @Override must override a superclass method 问题解决
- 北大ACM poj3051 Satellite Photographs
- nyoj_42 一笔画问题
- bundle通信----Event方式