void CJavaDlg::OnLiuLan()
{
UpdateData(1);
CFileDialog dlg(TRUE,NULL,NULL,OFN_HIDEREADONLY|OFN_OVERWRITEPROMPT);
if(dlg.DoModal()==IDOK)
{
address=dlg.GetPathName();
}
UpdateData(0);
}
7 个解决方案
#1
现在找到这样一个方法
UpdateData(1);
CDirDialog dlgDir;
dlgDir.m_strTitle=_T("选择JRE安装路径");
dlgDir.m_strSelDir="C:\\Program Files";
dlgDir.m_strWindowTitle=_T("Select directory");
if(dlgDir.DoBrowse(this)==IDOK)
{
address=dlgDir.m_strPath;
}
UpdateData(0);
报错:
error C2065: 'CDirDialog' : undeclared identifier
error C2146: syntax error : missing ';' before identifier 'dlgDir'
error C2065: 'dlgDir' : undeclared identifier
error C2228: left of '.m_strTitle' must have class/struct/union type
error C2228: left of '.m_strSelDir' must have class/struct/union type
error C2228: left of '.m_strWindowTitle' must have class/struct/union type
error C2228: left of '.DoBrowse' must have class/struct/union type
error C2228: left of '.m_strPath' must have class/struct/union type
请问需要include什么?DirDialog.h我试过没用
UpdateData(1);
CDirDialog dlgDir;
dlgDir.m_strTitle=_T("选择JRE安装路径");
dlgDir.m_strSelDir="C:\\Program Files";
dlgDir.m_strWindowTitle=_T("Select directory");
if(dlgDir.DoBrowse(this)==IDOK)
{
address=dlgDir.m_strPath;
}
UpdateData(0);
报错:
error C2065: 'CDirDialog' : undeclared identifier
error C2146: syntax error : missing ';' before identifier 'dlgDir'
error C2065: 'dlgDir' : undeclared identifier
error C2228: left of '.m_strTitle' must have class/struct/union type
error C2228: left of '.m_strSelDir' must have class/struct/union type
error C2228: left of '.m_strWindowTitle' must have class/struct/union type
error C2228: left of '.DoBrowse' must have class/struct/union type
error C2228: left of '.m_strPath' must have class/struct/union type
请问需要include什么?DirDialog.h我试过没用
#2
'CDirDialog' 这个类都没定义啊,把这个类定义头文件包含进来;
下面的几个错误都是这个原因引起的。
下面的几个错误都是这个原因引起的。
#3
麻烦详细说明一下CDirDialog怎么定义~或者有其他的更方便的办法吗?用CFileDialog不行吗?谢谢
#4
在你用CDirDialog的cpp文件中
#include "DirDialog.h"
#include "DirDialog.h"
#5
我引用试过了,会报错,错误信息:fatal error C1083: Cannot open include file: 'DirDialog.h': No such file or directory
#6
你用CDirDialog类,有没有源代码在里面当然会报错了。
这个CDirDialog类不是MFC的,是别人扩充的。
http://topic.csdn.net/t/20020930/07/1065433.html
这个CDirDialog类不是MFC的,是别人扩充的。
http://topic.csdn.net/t/20020930/07/1065433.html
#7
自己解决了,CDirDialog那个太麻烦了,始终搞不懂,看我的代码吧,如下:
char path[1024];
BROWSEINFO bi;
ITEMIDLIST* pidl;
bi.hwndOwner=this->GetSafeHwnd();
bi.iImage=0;
bi.lParam=0;
bi.lpfn=0;
bi.lpszTitle="请选择目录:";
bi.pidlRoot=0;
bi.pszDisplayName=0;
bi.ulFlags=BIF_RETURNONLYFSDIRS;
pidl=SHBrowseForFolder(&bi);
if(SHGetPathFromIDList(pidl,path)==TRUE)
{
address=path;
}
char path[1024];
BROWSEINFO bi;
ITEMIDLIST* pidl;
bi.hwndOwner=this->GetSafeHwnd();
bi.iImage=0;
bi.lParam=0;
bi.lpfn=0;
bi.lpszTitle="请选择目录:";
bi.pidlRoot=0;
bi.pszDisplayName=0;
bi.ulFlags=BIF_RETURNONLYFSDIRS;
pidl=SHBrowseForFolder(&bi);
if(SHGetPathFromIDList(pidl,path)==TRUE)
{
address=path;
}
#1
现在找到这样一个方法
UpdateData(1);
CDirDialog dlgDir;
dlgDir.m_strTitle=_T("选择JRE安装路径");
dlgDir.m_strSelDir="C:\\Program Files";
dlgDir.m_strWindowTitle=_T("Select directory");
if(dlgDir.DoBrowse(this)==IDOK)
{
address=dlgDir.m_strPath;
}
UpdateData(0);
报错:
error C2065: 'CDirDialog' : undeclared identifier
error C2146: syntax error : missing ';' before identifier 'dlgDir'
error C2065: 'dlgDir' : undeclared identifier
error C2228: left of '.m_strTitle' must have class/struct/union type
error C2228: left of '.m_strSelDir' must have class/struct/union type
error C2228: left of '.m_strWindowTitle' must have class/struct/union type
error C2228: left of '.DoBrowse' must have class/struct/union type
error C2228: left of '.m_strPath' must have class/struct/union type
请问需要include什么?DirDialog.h我试过没用
UpdateData(1);
CDirDialog dlgDir;
dlgDir.m_strTitle=_T("选择JRE安装路径");
dlgDir.m_strSelDir="C:\\Program Files";
dlgDir.m_strWindowTitle=_T("Select directory");
if(dlgDir.DoBrowse(this)==IDOK)
{
address=dlgDir.m_strPath;
}
UpdateData(0);
报错:
error C2065: 'CDirDialog' : undeclared identifier
error C2146: syntax error : missing ';' before identifier 'dlgDir'
error C2065: 'dlgDir' : undeclared identifier
error C2228: left of '.m_strTitle' must have class/struct/union type
error C2228: left of '.m_strSelDir' must have class/struct/union type
error C2228: left of '.m_strWindowTitle' must have class/struct/union type
error C2228: left of '.DoBrowse' must have class/struct/union type
error C2228: left of '.m_strPath' must have class/struct/union type
请问需要include什么?DirDialog.h我试过没用
#2
'CDirDialog' 这个类都没定义啊,把这个类定义头文件包含进来;
下面的几个错误都是这个原因引起的。
下面的几个错误都是这个原因引起的。
#3
麻烦详细说明一下CDirDialog怎么定义~或者有其他的更方便的办法吗?用CFileDialog不行吗?谢谢
#4
在你用CDirDialog的cpp文件中
#include "DirDialog.h"
#include "DirDialog.h"
#5
我引用试过了,会报错,错误信息:fatal error C1083: Cannot open include file: 'DirDialog.h': No such file or directory
#6
你用CDirDialog类,有没有源代码在里面当然会报错了。
这个CDirDialog类不是MFC的,是别人扩充的。
http://topic.csdn.net/t/20020930/07/1065433.html
这个CDirDialog类不是MFC的,是别人扩充的。
http://topic.csdn.net/t/20020930/07/1065433.html
#7
自己解决了,CDirDialog那个太麻烦了,始终搞不懂,看我的代码吧,如下:
char path[1024];
BROWSEINFO bi;
ITEMIDLIST* pidl;
bi.hwndOwner=this->GetSafeHwnd();
bi.iImage=0;
bi.lParam=0;
bi.lpfn=0;
bi.lpszTitle="请选择目录:";
bi.pidlRoot=0;
bi.pszDisplayName=0;
bi.ulFlags=BIF_RETURNONLYFSDIRS;
pidl=SHBrowseForFolder(&bi);
if(SHGetPathFromIDList(pidl,path)==TRUE)
{
address=path;
}
char path[1024];
BROWSEINFO bi;
ITEMIDLIST* pidl;
bi.hwndOwner=this->GetSafeHwnd();
bi.iImage=0;
bi.lParam=0;
bi.lpfn=0;
bi.lpszTitle="请选择目录:";
bi.pidlRoot=0;
bi.pszDisplayName=0;
bi.ulFlags=BIF_RETURNONLYFSDIRS;
pidl=SHBrowseForFolder(&bi);
if(SHGetPathFromIDList(pidl,path)==TRUE)
{
address=path;
}