|
如果是选择路径的话,可用SHBrowseForFolder函数,示例如下:
LRESULT OnSelectPath(WORD /*wNotifyCode*/, WORD wID, HWND /*hWndCtl*/, BOOL& /*bHandled*/)
{
BROWSEINFO bi = {0};
TCHAR szPath[MAX_PATH];
LPITEMIDLIST pidl = NULL;
bi.hwndOwner = m_hWnd;
bi.pidlRoot = NULL;
bi.lpszTitle = _T("请选择镜像目录");
bi.ulFlags = BIF_RETURNONLYFSDIRS | BIF_BROWSEFORCOMPUTER;
bi.lpfn = BrowseCallbackProc;
bi.lParam = (LPARAM)this;
if(pidl = SHBrowseForFolder(&bi))
{
if (SHGetPathFromIDList(pidl, szPath))
{
m_cbxImagePath.ResetContent();
m_cbxImagePath.AddString(szPath);
m_cbxImagePath.SetCurSel(0);
}
}
return 0;
} |
|