首页上一页 1 下一页尾页 1 条记录 1/1页
Visual C++ 项目开发全程实录 超市进销存管理系统 登陆模块问题
发表在C语言图书答疑
2012-02-20
是否精华
是
否
版块置顶:
是
否
BOOL CLogin::PreTranslateMessage(MSG* pMsg)
{
// TODO: Add your specialized code here and/or call the base class
if(pMsg->message==WM_KEYDOWN && pMsg->wParam==13)
{
pMsg->wParam = 9;
}
if(pMsg->message == WM_LBUTTONDOWN)
{
CRect rect,rc;
m_OK.GetWindowRect(&rect);
m_Cancel.GetWindowRect(&rc);
CPoint point;
GetCursorPos(&point);
if(rect.PtInRect(point))
{
UpdateData(TRUE);
if(m_Name.IsEmpty() || m_PassWord.IsEmpty())
{
MessageBox("用户名或密码不能为空");
return FALSE;
}
m_Time++;
ADOConn m_AdoConn;
m_AdoConn.OnInitADOConn();
CString sql;
sql.Format("select * from CTXSYS.TB_USER where NAME='%s' and PWD='%s' and POPEDOM='1'",
m_Name,m_PassWord);
m_AdoConn.m_pRecordset = m_AdoConn.GetRecordSet((_bstr_t)sql);
if(!m_AdoConn.m_pRecordset->adoEOF)
{
m_UserName = m_Name;
CDialog::OnOK();
}
else
{
if(m_Time == 3)
{
MessageBox("密码3次不正确");
CDialog::OnCancel();
}
else
{
MessageBox("用户名或密码不正确");
m_Name = "";
m_PassWord = "";
UpdateData(FALSE);
}
}
m_AdoConn.ExitConnect();
}
if(rc.PtInRect(point))
{
CDialog::OnCancel();
}
}
return CDialog::PreTranslateMessage(pMsg);
视频里,登陆这个模块的内容好像没有说到呢,很多的代码我都不懂,特别是上面这个函数,可以解释下具体是什么意思吗?谢谢
我添加了 'PreTranslateMessage'这个成员函数,编译时提示 m_UserName 没有定义,怎么解决?我看原代码,也没看到有关于m_UserName 这个变量的定义,原代码编译也没有出现错误,是怎么回事?
{
// TODO: Add your specialized code here and/or call the base class
if(pMsg->message==WM_KEYDOWN && pMsg->wParam==13)
{
pMsg->wParam = 9;
}
if(pMsg->message == WM_LBUTTONDOWN)
{
CRect rect,rc;
m_OK.GetWindowRect(&rect);
m_Cancel.GetWindowRect(&rc);
CPoint point;
GetCursorPos(&point);
if(rect.PtInRect(point))
{
UpdateData(TRUE);
if(m_Name.IsEmpty() || m_PassWord.IsEmpty())
{
MessageBox("用户名或密码不能为空");
return FALSE;
}
m_Time++;
ADOConn m_AdoConn;
m_AdoConn.OnInitADOConn();
CString sql;
sql.Format("select * from CTXSYS.TB_USER where NAME='%s' and PWD='%s' and POPEDOM='1'",
m_Name,m_PassWord);
m_AdoConn.m_pRecordset = m_AdoConn.GetRecordSet((_bstr_t)sql);
if(!m_AdoConn.m_pRecordset->adoEOF)
{
m_UserName = m_Name;
CDialog::OnOK();
}
else
{
if(m_Time == 3)
{
MessageBox("密码3次不正确");
CDialog::OnCancel();
}
else
{
MessageBox("用户名或密码不正确");
m_Name = "";
m_PassWord = "";
UpdateData(FALSE);
}
}
m_AdoConn.ExitConnect();
}
if(rc.PtInRect(point))
{
CDialog::OnCancel();
}
}
return CDialog::PreTranslateMessage(pMsg);
视频里,登陆这个模块的内容好像没有说到呢,很多的代码我都不懂,特别是上面这个函数,可以解释下具体是什么意思吗?谢谢
我添加了 'PreTranslateMessage'这个成员函数,编译时提示 m_UserName 没有定义,怎么解决?我看原代码,也没看到有关于m_UserName 这个变量的定义,原代码编译也没有出现错误,是怎么回事?