首页上一页 1 下一页尾页 1 条记录 1/1页
windows对话框
发表在C语言图书答疑
2012-11-24
是否精华
是
否
版块置顶:
是
否
从入门到精通第三版第六章第七节中下面一段代码:
void CMy12Dlg::OnOpen()
{
// TODO: Add your control notification handler code here
CFileDialog dlg(TRUE,NULL,NULL,OFN_HIDEREADONLY|OFN_OVERWRITEPROMPT,"All Files(*.TXT)|*.TXT||",AfxGetMainWnd());
CString strPath,strText="";
if (dlg.DoModal() == IDOK)
{
strPath = dlg.GetPathName();
m_OpenPath.SetWindowText(strPath);
CFile file(strPath,CFile::modeRead);
char read[10000];
file.Read(read,10000);
for(int i = 0; i < file.GetLength(); i++)
{
strText += read[i];
}
file.Close();
m_FileText.SetWindowText(strText);
}
}
其中“m_OpenPath.SetWindowText(strPath);”这句话出错了,错误提示为:
'm_OpenPath' : undeclared identifier
求解决,谢谢
void CMy12Dlg::OnOpen()
{
// TODO: Add your control notification handler code here
CFileDialog dlg(TRUE,NULL,NULL,OFN_HIDEREADONLY|OFN_OVERWRITEPROMPT,"All Files(*.TXT)|*.TXT||",AfxGetMainWnd());
CString strPath,strText="";
if (dlg.DoModal() == IDOK)
{
strPath = dlg.GetPathName();
m_OpenPath.SetWindowText(strPath);
CFile file(strPath,CFile::modeRead);
char read[10000];
file.Read(read,10000);
for(int i = 0; i < file.GetLength(); i++)
{
strText += read[i];
}
file.Close();
m_FileText.SetWindowText(strText);
}
}
其中“m_OpenPath.SetWindowText(strPath);”这句话出错了,错误提示为:
'm_OpenPath' : undeclared identifier
求解决,谢谢