Professional UI Solutions
Site Map   /  Register
 
 

Forum

Please Log In to post a new message or reply to an existing one. If you are not registered, please register.

NOTE: Some forums may be read-only if you are not currently subscribed to our technical support services.

Forums » Prof-UIS General Discussion » Destroying CExtControlBar child dialog Collapse All
Subject Author Date
Mateusz Zawilo May 14, 2008 - 5:28 AM

Hello.


I’ve got problem with destroying autohidden CExtControlBar child dialog. When bar is shown everything is ok, but when it’s hidden "CExtNCW<CMDIFrameWnd>::DestroyWindow()" called on the end of program asserts. Any ideas what am I doing wrong?


 

Technical Support May 14, 2008 - 9:27 AM

We guess the CWnd::GetDlgCtrlID() method asserts because it is invoked for the CWnd object of an already destroyed window. I.e. this CWnd object is simply a C++ object in memory and it’s no longer attached to a valid window handle. You can try to destroy your dialog window manually in the CMainFrame::DestroyWindow() virtual method before invoking the parent class method. Just invoke pDialog->DestroyWindow() for it.

Mateusz Zawilo May 15, 2008 - 2:47 AM

I’m affraid it’s not working. DestroyWIndow for child dialogs works ok, then CMainFrame::DestroyWindow asserts in the same place as before.


<table width="100%" cellspacing="0" cellpadding="0" style="height: 100%; table-layout: fixed;">
<tbody>
<tr>
<td valign="top" style="height: 100%;" id="xEditingArea"><iframe width="100%" height="100%" frameborder="0" src="javascript:void(0)" style="height: 346px;"></iframe></td>
</tr>
</tbody>
</table>

Technical Support May 16, 2008 - 2:54 AM

Unfortunately there is not enough information in your messages to find out what is wrong. Even the call stack listing in your previous message looks like partial and does not tell us the exact location of the problem. Would you create a stripped version of your project and send it to us?

Mateusz Zawilo May 16, 2008 - 5:04 AM

It won’t be that easy I’m affraid. At the moment I found very "bad looking" solution, I’m setting AutoHideMode to "false" after saving interface, before calling "DestroyWindow". If I’ll find some time,  I’ll try to figure out what’s wrong with this assert.


Thanks for all replays.

Mateusz Zawilo May 14, 2008 - 8:20 AM

Thanks for fast replay.


This is the call stack:


>    Viewer.exe!CMainFrame::DestroyWindow()  Line 685    C++

     mfc71ud.dll!CFrameWnd::OnClose()  Line 851    C++

     Viewer.exe!CMainFrame::OnClose()  Line 213    C++

     mfc71ud.dll!CWnd::OnWndMsg(unsigned int message=16, unsigned int wParam=0, long lParam=0, long * pResult=0x0012e9bc)  Line 2023    C++

     Viewer.exe!CMainFrame::OnWndMsg(unsigned int message=16, unsigned int wParam=0, long lParam=0, long * pResult=0x0012e9bc)  Line 602    C++

     mfc71ud.dll!CWnd::WindowProc(unsigned int message=16, unsigned int wParam=0, long lParam=0)  Line 1745 + 0x1e    C++

     Viewer.exe!CExtNCW<CMDIFrameWnd>::WindowProc(unsigned int message=16, unsigned int wParam=0, long lParam=0)  Line 554 + 0x14    C++

     mfc71ud.dll!AfxCallWndProc(CWnd * pWnd=0x0b6f6e80, HWND__ * hWnd=0x00031036, unsigned int nMsg=16, unsigned int wParam=0, long lParam=0)  Line 241 + 0x1a    C++

     mfc71ud.dll!AfxWndProc(HWND__ * hWnd=0x00031036, unsigned int nMsg=16, unsigned int wParam=0, long lParam=0)  Line 389    C++

     mfc71ud.dll!AfxWndProcBase(HWND__ * hWnd=0x00031036, unsigned int nMsg=16, unsigned int wParam=0, long lParam=0)  Line 209 + 0x15    C++


Function asserts in this place:


int CWnd::GetDlgCtrlID() const

{

    ASSERT(::IsWindow(m_hWnd) || (m_pCtrlSite != NULL));



    if (m_pCtrlSite == NULL)

        return ::GetDlgCtrlID(m_hWnd);

    else

        return m_pCtrlSite->GetDlgCtrlID();

}


 

Technical Support May 14, 2008 - 7:41 AM

It would be helpful to take a look at the call stack list demonstrating the crash at shutdown.