如何用VC++6.0(MFC)编程实现用按钮打开、保存文件 10
点击打开按钮,即打开如下对话框:"target="_blank">"target="_blank">>...
点击 打开 按钮,即打开如下对话框:
" target="_blank" >
" target="_blank" >
> 展开
" target="_blank" >
" target="_blank" >
> 展开
若以下回答无法解决问题,邀请你更新回答
1个回答
展开全部
void CCopyfileDlg::OnButton1()
{
// TODO: Add your control notification handler code here
TCHAR pszBuffer[_MAX_PATH];
BROWSEINFO bi; LPITEMIDLIST pidl;
bi.hwndOwner = NULL;
bi.pidlRoot = NULL;
bi.pszDisplayName = pszBuffer;
bi.lpszTitle = _T("选择文件的路径");
bi.ulFlags = BIF_RETURNFSANCESTORS | BIF_RETURNONLYFSDIRS;
bi.lpfn = NULL;
bi.lParam = 0;
if((pidl = SHBrowseForFolder(&bi)) != NULL)
{
if(SHGetPathFromIDList(pidl, pszBuffer))
{
CString strTemp(pszBuffer); Stopath = strTemp;
/*
if (Ptopath.GetLength() <= 1)
{
}
else if (Ptopath.Right(1) != _T("\\"))
Ptopath += _T("\\");
*/
}
}
GetDlgItem(IDC_STATIC1)->SetWindowText(Stopath);
}
或者用CFile Dlg中的domodel::
CFileDialog dlg(TRUE,"","");
if(dlg.DoModal()==IDOK) {....}
上网随便看看,简单啊
{
// TODO: Add your control notification handler code here
TCHAR pszBuffer[_MAX_PATH];
BROWSEINFO bi; LPITEMIDLIST pidl;
bi.hwndOwner = NULL;
bi.pidlRoot = NULL;
bi.pszDisplayName = pszBuffer;
bi.lpszTitle = _T("选择文件的路径");
bi.ulFlags = BIF_RETURNFSANCESTORS | BIF_RETURNONLYFSDIRS;
bi.lpfn = NULL;
bi.lParam = 0;
if((pidl = SHBrowseForFolder(&bi)) != NULL)
{
if(SHGetPathFromIDList(pidl, pszBuffer))
{
CString strTemp(pszBuffer); Stopath = strTemp;
/*
if (Ptopath.GetLength() <= 1)
{
}
else if (Ptopath.Right(1) != _T("\\"))
Ptopath += _T("\\");
*/
}
}
GetDlgItem(IDC_STATIC1)->SetWindowText(Stopath);
}
或者用CFile Dlg中的domodel::
CFileDialog dlg(TRUE,"","");
if(dlg.DoModal()==IDOK) {....}
上网随便看看,简单啊
本回答被网友采纳
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询