打开选择文件对话框

文件路径最后保存在str中

	CString str;
	char name[MAX_PATH];
	BROWSEINFO bi;
	ZeroMemory(&bi,sizeof(BROWSEINFO));
	bi.hwndOwner = GetSafeHwnd(); 
	bi.pidlRoot = NULL;
	bi.pszDisplayName = name;
	bi.lpszTitle = "请选则文件";
	bi.ulFlags = BIF_BROWSEINCLUDEFILES;
	LPITEMIDLIST idl = SHBrowseForFolder(&bi); 
	if(idl == NULL)	return;
	SHGetPathFromIDList(idl,str.GetBuffer(MAX_PATH));
	str.ReleaseBuffer();


 

你可能感兴趣的:(null,BI,Path)