Assertion beim schliessen eines Dialogs
-
Hi,
ich hab ein ziemlich merkwürdiges Problem. Ich habe für ein Projekt einen vc6 Dialog erstellt. Nun soll dieser Dialog als eigene Komponente (Dll) in ein neues Projekt (.net) integriert werden.
Es klappt alles, außer ich versuche den Dialog mit dem Standard-Ok Button zu schließen. Dann kommt ein Assert wincore.cpp Line 1008. Ich benutze für das Ok die Standard OnOk-Funktion von CDialog.
Ich Poste mal die Stelle der Wincore wo es crasht
BOOL CWnd::DestroyWindow() { CWnd* pWnd; CHandleMap* pMap; HWND hWndOrig; BOOL bResult; if ((m_hWnd == NULL) && (m_pCtrlSite == NULL)) return FALSE; bResult = FALSE; pMap = NULL; pWnd = NULL; hWndOrig = NULL; if (m_hWnd != NULL) { pMap = afxMapHWND(); ASSERT(pMap != NULL); pWnd = (CWnd*)pMap->LookupPermanent(m_hWnd); #ifdef _DEBUG hWndOrig = m_hWnd; #endif } #ifdef _AFX_NO_OCC_SUPPORT if (m_hWnd != NULL) bResult = ::DestroyWindow(m_hWnd); #else //_AFX_NO_OCC_SUPPORT if ((m_hWnd != NULL) || (m_pCtrlSite != NULL)) { if (m_pCtrlSite == NULL) bResult = ::DestroyWindow(m_hWnd); //////////Ich denke hier liegt das Probem, da das hWnd zerstört wird. else bResult = m_pCtrlSite->DestroyControl(); } #endif //_AFX_NO_OCC_SUPPORT if (hWndOrig != NULL) { // Note that 'this' may have been deleted at this point, // (but only if pWnd != NULL) if (pWnd != NULL) { // Should have been detached by OnNcDestroy #ifdef _DEBUG ASSERT(pMap->LookupPermanent(hWndOrig) == NULL); #endif } else { #ifdef _DEBUG ASSERT(m_hWnd == hWndOrig); ////////////////Hier tritt die Assertion auf, da m_hWnd ja null ist und hWndOrig natürlich nicht #endif // Detach after DestroyWindow called just in case Detach(); } } return bResult; }
-
Dieser Thread wurde von Moderator/in CMatt aus dem Forum C# und .NET in das Forum MFC (Visual C++) verschoben.
Im Zweifelsfall bitte auch folgende Hinweise beachten:
C/C++ Forum :: FAQ - Sonstiges :: Wohin mit meiner Frage?Dieses Posting wurde automatisch erzeugt.