Advertisement

10.02.2008 at 02:05AM PDT, ID: 23780840 | Points: 500
[x]
Attachment Details

Application hangs in MFC in _AfxNextControl

Asked by netformx in Windows MFC Programming, Windows Programming

Tags: ,

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!_AfxRemoveDefaultButton(CWnd * pWndRoot=0x2117d09c, CWnd * pWndStart=0x0d3c19b0)  Line 483      C++
       mfc80d.dll!_AfxCheckDefPushButton(CWnd * pWndRoot=0x2117d09c, CWnd * pWndOldFocus=0x1926dddc, CWnd * pWndNewFocus=0x0d42f6b0)  Line 549      C++
       mfc80d.dll!COccManager::IsDialogMessageA(CWnd * pWndDlg=0x2117d09c, tagMSG * lpMsg=0x0015d790)  Line 816      C++
       mfc80d.dll!CWnd::IsDialogMessageA(tagMSG * lpMsg=0x0015d790)  Line 195 + 0x20 bytes      C++
       mfc80d.dll!CWnd::PreTranslateInput(tagMSG * lpMsg=0x0015d790)  Line 4268      C++
       mfc80d.dll!CControlBar::PreTranslateMessage(tagMSG * pMsg=0x0015d790)  Line 443 + 0xc bytes      C++
       mfc80d.dll!CWnd::WalkPreTranslateTree(HWND__ * hWndStop=0x00080aee, tagMSG * pMsg=0x0015d790)  Line 2882 + 0x14 bytes      C++
       mfc80d.dll!AfxInternalPreTranslateMessage(tagMSG * pMsg=0x0015d790)  Line 233 + 0x12 bytes      C++
       mfc80d.dll!CWinThread::PreTranslateMessage(tagMSG * pMsg=0x0015d790)  Line 773 + 0x9 bytes      C++
       mfc80d.dll!AfxPreTranslateMessage(tagMSG * pMsg=0x0015d790)  Line 252 + 0x11 bytes      C++
       mfc80d.dll!AfxInternalPumpMessage()  Line 178 + 0x18 bytes      C++
       mfc80d.dll!CWinThread::PumpMessage()  Line 896      C++
       mfc80d.dll!CWinThread::Run()  Line 625 + 0xd bytes      C++
       mfc80d.dll!CWinApp::Run()  Line 894      C++
       mfc80d.dll!AfxWinMain(HINSTANCE__ * hInstance=0x00400000, HINSTANCE__ * hPrevInstance=0x00000000, char * lpCmdLine=0x00151f05, int nCmdShow=5)  Line 47 + 0xd bytes      C++
       Netedit.exe!WinMain(HINSTANCE__ * hInstance=0x00400000, HINSTANCE__ * hPrevInstance=0x00000000, char * lpCmdLine=0x00151f05, int nCmdShow=5)  Line 33      C++
       Netedit.exe!__tmainCRTStartup()  Line 589 + 0x35 bytes      C
       Netedit.exe!WinMainCRTStartup()  Line 414      C

The application hangs inside MFC in _AfxRemoveDefaultButton method. The code below I copied from _AfxRemoveDefaultButton:

      do
      {
            COccManager::SetDefaultButton(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
[+][-]10.10.2008 at 07:24AM PDT, ID: 22687166

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]10.15.2008 at 01:59AM PDT, ID: 22718981

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]10.15.2008 at 02:01AM PDT, ID: 22718993

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]10.15.2008 at 09:55AM PDT, ID: 22723222

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]10.28.2008 at 02:53AM PDT, ID: 22820024

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
 
Loading Advertisement...
20081112-EE-VQP-42 - Hierarchy / EE_QW_2_20070628