Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. Close MDI Child Window Fail ???

Close MDI Child Window Fail ???

Scheduled Pinned Locked Moved C / C++ / MFC
helpc++question
1 Posts 1 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • _ Offline
    _ Offline
    _skidrow_vn_
    wrote on last edited by
    #1

    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();
    	}
    	
    }
    
    1 Reply Last reply
    0
    Reply
    • Reply as topic
    Log in to reply
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes


    • Login

    • Don't have an account? Register

    • Login or register to search.
    • First post
      Last post
    0
    • Categories
    • Recent
    • Tags
    • Popular
    • World
    • Users
    • Groups