纠结了一天了,catch到的错误就是无效指针,小弟新手,就是个登陆界面,求解决啊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_pwd.IsEmpty())
{
MessageBox("用户名或密码不能为空");
return FALSE;
}
m_time++;
try
{
//创建连接对象实例

m_pConnection.CreateInstance(__uuidof(Connection));
//设置连接字符串
CString strConnect="Provider=Microsoft.Jet.OLEDB.4.0;Data Source = shujuku.mdb;UserId=admin;Password=;";
//使用Open方法连接数据库
m_pConnection->Open((_bstr_t)strConnect,"","",adModeUnknown);
}
catch(_com_error e)
{
CString  strError;
strError.Format("警告打开异常,错误信息:%s",e.ErrorMessage());
AfxMessageBox(strError);
return FALSE;
}
CString sql;
//UpdateData(false);
try
{
sql.Format("select * from tb_user where 用户名 = '%s' and 密码 = '%s'",
m_name,m_pwd);
m_pRecordset = m_pConnection->Execute((_bstr_t)sql,NULL,adCmdText);
}
catch(_com_error e)
{
CString  strError;
strError.Format("警告打开异常,错误信息:%s",e.ErrorMessage());
AfxMessageBox(strError);
return FALSE;
}
if(!m_pRecordset->adoEOF)
{

CDialog::OnOK();
}
else
{
if(m_time == 3)
{
MessageBox("密码3次不正确");
CDialog::OnCancel();
}
else
{
MessageBox("用户名或密码不正确");
m_name = "";
m_pwd = "";
UpdateData(FALSE);
}
}
if(m_pRecordset!=NULL)
m_pRecordset->Close();
m_pConnection->Close();
}
if(rc.PtInRect(point))
{
CDialog::OnCancel();
}
}
return CDialog::PreTranslateMessage(pMsg);
}