shamantou blog site

shamantou@gmail.com

导航

如何得到文件夹浏览的dlg
CString CMedPlantDoc::GetFilePath(CString description)
{
CString sFolderPath;
BROWSEINFO bi;
char Buffer[MAX_PATH];
CString path;

//³õʼ»¯Èë¿Ú²ÎÊýbi¿ªÊ¼
bi.hwndOwner = NULL;
bi.pidlRoot = NULL;
bi.pszDisplayName = Buffer;//´Ë²ÎÊýÈçΪNULLÔò²»ÄÜÏÔʾ¶Ô»°¿ò
bi.lpszTitle = description;
bi.ulFlags = 0;
bi.lpfn = NULL;
bi.iImage=NULL;

//³õʼ»¯Èë¿Ú²ÎÊýbi½áÊø
LPITEMIDLIST pIDList = SHBrowseForFolder(&bi);//µ÷ÓÃÏÔʾѡÔñ¶Ô»°¿ò
if(pIDList)
{
SHGetPathFromIDList(pIDList, Buffer);
//È¡µÃÎļþ¼Ð·¾¶µ½BufferÀï
sFolderPath = Buffer;//½«Â·¾¶±£´æÔÚÒ»¸öCString¶ÔÏóÀï
}

LPMALLOC lpMalloc;
if(FAILED(SHGetMalloc(&lpMalloc))) return path;

//ÊÍ·ÅÄÚ´æ
lpMalloc->Free(pIDList);
lpMalloc->Release();
path=Buffer;
return path;
}
<< sigh,被逮了半透明头颅显示 >>

发表评论:

◎欢迎参与讨论,请在这里发表您的看法、交流您的观点。

最近发表

Powered By Z-Blog 1.8 Arwen Build 81206 Copyright 2006-2009 | ooplab.org | shamantou@gmail.com | 沪ICP备08011244号 | Some Rights Reserved.