vc++6.0从入门到精通第三版,第二篇第六章,例【6.6】有些个步骤在光盘上没有?181页和182页。
自然规律 发表于2017-08-01 18:03
好的,谢谢
------------------Configuration: FileDialog - Win32 Debug--------------------
Compiling...
FileDialogDlg.cpp
D:\我的文档\Microsoft Visual Studio\MyProjects\FileDialog\FileDialogDlg.cpp(182) : error C2065: 'm_OpenPath' : undeclared identifier
D:\我的文档\Microsoft Visual Studio\MyProjects\FileDialog\FileDialogDlg.cpp(182) : error C2228: left of '.SetWindowTextA' must have class/struct/union type
D:\我的文档\Microsoft Visual Studio\MyProjects\FileDialog\FileDialogDlg.cpp(186) : error C2143: syntax error : missing ';' before 'if'
D:\我的文档\Microsoft Visual Studio\MyProjects\FileDialog\FileDialogDlg.cpp(186) : error C2143: syntax error : missing ')' before 'if'
D:\我的文档\Microsoft Visual Studio\MyProjects\FileDialog\FileDialogDlg.cpp(186) : error C2059: syntax error : '<'
D:\我的文档\Microsoft Visual Studio\MyProjects\FileDialog\FileDialogDlg.cpp(186) : error C2059: syntax error : ')'
D:\我的文档\Microsoft Visual Studio\MyProjects\FileDialog\FileDialogDlg.cpp(187) : error C2143: syntax error : missing ';' before '{'
D:\我的文档\Microsoft Visual Studio\MyProjects\FileDialog\FileDialogDlg.cpp(191) : error C2065: 'm_FileText' : undeclared identifier
D:\我的文档\Microsoft Visual Studio\MyProjects\FileDialog\FileDialogDlg.cpp(191) : error C2228: left of '.SetWindowTextA' must have class/struct/union type
执行 cl.exe 时出错.
自然规律 发表于2017-08-02 01:20
------------------Configuration: FileDialog - Win32 Debug--------------------
Compiling...
FileDialogDlg.cpp
D:\我的文档\Microsoft Visual Studio\MyProjects\FileDialog\FileDialogDlg.cpp(182) : error C2065: 'm_OpenPath' : undeclared identifier
D:\我的文档\Microsoft Visual Studio\MyProjects\FileDialog\FileDialogDlg.cpp(182) : error C2228: left of '.SetWindowTextA' must have class/struct/union type
D:\我的文档\Microsoft Visual Studio\MyProjects\FileDialog\FileDialogDlg.cpp(186) : error C2143: syntax error : missing ';' before 'if'
D:\我的文档\Microsoft Visual Studio\MyProjects\FileDialog\FileDialogDlg.cpp(186) : error C2143: syntax error : missing ')' before 'if'
D:\我的文档\Microsoft Visual Studio\MyProjects\FileDialog\FileDialogDlg.cpp(186) : error C2059: syntax error : '<'
D:\我的文档\Microsoft Visual Studio\MyProjects\FileDialog\FileDialogDlg.cpp(186) : error C2059: syntax error : ')'
D:\我的文档\Microsoft Visual Studio\MyProjects\FileDialog\FileDialogDlg.cpp(187) : error C2143: syntax error : missing ';' before '{'
D:\我的文档\Microsoft Visual Studio\MyProjects\FileDialog\FileDialogDlg.cpp(191) : error C2065: 'm_FileText' : undeclared identifier
D:\我的文档\Microsoft Visual Studio\MyProjects\FileDialog\FileDialogDlg.cpp(191) : error C2228: left of '.SetWindowTextA' must have class/struct/union type
执行 cl.exe 时出错.
void CFileDialogDlg::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;if<file.GetLength();i++)
{
strText+=read[i];
}
file.Close();
m_FileText.SetWindowText(strText);
这是这段程序
自然规律 发表于2017-08-02 01:21
void CFileDialogDlg::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;if<file.GetLength();i++)
{
strText+=read[i];
}
file.Close();
m_FileText.SetWindowText(strText);
这是这段程序