代码如下:
void Czhangyu2Dlg::OnBnClickedButton1()
{
// TODO: 在此添加控件通知处理程序代码
CString psw;
CString str;
CString guess;
zy_psw.GetWindowTextW(psw);
int size;
int zy;
size=zy_psw.GetWindowTextLengthW();
/////////////////////////
char *pszFileName="2.txt";
CStdioFile myFile;
CFileException fileException;
if(!myFile.Open(_T("2.txt"),CFile::modeCreate|CFile::typeText|CFile::modeRead),&fileException)
{
TRACE("Can't open file %s,error=%u\n","2.txt",fileException.m_cause);
while (myFile.ReadString(str))
{
if(str==psw)
{
zy=1;
guess=str;}
}
if(zy==1)
{ //MessageBox("破解成功");
zy_result=guess;
UpdateData(TRUE);
}
}
}
运行的时候一按按钮就出错