Close MDI Child Window Fail ???
C / C++ / MFC
1
Posts
1
Posters
0
Views
1
Watching
-
in my MDI app.......I inserted a CRecordView-base Class named CLogin when I input my ID and my Password .... I want this form disappear but when app run to this line GetDocument()->OnCloseDocument(); Login Form is hide and a Error MessageBox show Unhandled exception in QLBH.exe (MFCD42D.DLL): 0xC0000005: Access Violation. and cursor point to this line in DBCORE.CPP like following:
BOOL CRecordset::IsOpen() const // Note: assumes base class CRecordset::Close called { if (m_hstmt == NULL) // Error in this line // return FALSE; ..... }
I tried use: SendMessage(WM_CLOSE) or SC_CLOSE or GetParentFrame()->SendMessage(WM_CLOSE); but no result help me thank
void CLogin::OnOk() { // TODO: Add your control notification handler code here CString strID,strPass; m_editID.GetWindowText(strID); m_editPass.GetWindowText(strPass); m_pSet->MoveFirst (); while(!m_pSet->IsEOF()) { if(!strID.Compare(m_pSet->m_ID)) { if (!strPass.Compare(m_pSet->m_Pass)) AfxMessageBox("ok"); else AfxMessageBox("wrong"); GetDocument()->OnCloseDocument(); //Error//:eek: //GetParentFrame()->SendMessage(WM_CLOSE); // error //:eek: } m_pSet->MoveNext(); } }