In MDI application I use CWinFormsControl to host a Windows Forms control. The application is a standard MFC application and the control is implemented in C#. When I open a window containing a Windows Forms control and click on another window (MFC based window) the application hangs. The following is a call stack:
> mfc80d.dll!_AfxRemoveDefau
ltButton(C
Wnd * pWndRoot=0x2117d09c, CWnd * pWndStart=0x0d3c19b0) Line 483 C++
mfc80d.dll!_AfxCheckDefPus
hButton(CW
nd * pWndRoot=0x2117d09c, CWnd * pWndOldFocus=0x1926dddc, CWnd * pWndNewFocus=0x0d42f6b0) Line 549 C++
mfc80d.dll!COccManager::Is
DialogMess
ageA(CWnd * pWndDlg=0x2117d09c, tagMSG * lpMsg=0x0015d790) Line 816 C++
mfc80d.dll!CWnd::IsDialogM
essageA(ta
gMSG * lpMsg=0x0015d790) Line 195 + 0x20 bytes C++
mfc80d.dll!CWnd::PreTransl
ateInput(t
agMSG * lpMsg=0x0015d790) Line 4268 C++
mfc80d.dll!CControlBar::Pr
eTranslate
Message(ta
gMSG * pMsg=0x0015d790) Line 443 + 0xc bytes C++
mfc80d.dll!CWnd::WalkPreTr
anslateTre
e(HWND__ * hWndStop=0x00080aee, tagMSG * pMsg=0x0015d790) Line 2882 + 0x14 bytes C++
mfc80d.dll!AfxInternalPreT
ranslateMe
ssage(tagM
SG * pMsg=0x0015d790) Line 233 + 0x12 bytes C++
mfc80d.dll!CWinThread::Pre
TranslateM
essage(tag
MSG * pMsg=0x0015d790) Line 773 + 0x9 bytes C++
mfc80d.dll!AfxPreTranslate
Message(ta
gMSG * pMsg=0x0015d790) Line 252 + 0x11 bytes C++
mfc80d.dll!AfxInternalPump
Message() Line 178 + 0x18 bytes C++
mfc80d.dll!CWinThread::Pum
pMessage()
Line 896 C++
mfc80d.dll!CWinThread::Run
() Line 625 + 0xd bytes C++
mfc80d.dll!CWinApp::Run() Line 894 C++
mfc80d.dll!AfxWinMain(HINS
TANCE__ * hInstance=0x00400000, HINSTANCE__ * hPrevInstance=0x00000000, char * lpCmdLine=0x00151f05, int nCmdShow=5) Line 47 + 0xd bytes C++
Netedit.exe!WinMain(HINSTA
NCE__ * hInstance=0x00400000, HINSTANCE__ * hPrevInstance=0x00000000, char * lpCmdLine=0x00151f05, int nCmdShow=5) Line 33 C++
Netedit.exe!__tmainCRTStar
tup() Line 589 + 0x35 bytes C
Netedit.exe!WinMainCRTStar
tup() Line 414 C
The application hangs inside MFC in _AfxRemoveDefaultButton method. The code below I copied from _AfxRemoveDefaultButton:
do
{
COccManager::SetDefaultBut
ton(pWnd, FALSE);
pWndNext = _AfxNextControl(pWndRoot, pWnd, 0);
pWnd = pWndNext;
}
while ((pWnd != NULL) && (pWnd != pWndStart));
_AfxNextControl always returns the same window and AfxRemoveDefaultButton is stuck in the loop.
Start Free Trial