SubclassWindow causes stack overflow in CMainFrame::OnCreate()
CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 2 of 2

Thread: SubclassWindow causes stack overflow in CMainFrame::OnCreate()

  1. #1
    Join Date
    Jul 2009
    Posts
    1

    SubclassWindow causes stack overflow in CMainFrame::OnCreate()

    I recently upgraded my MS Visual Studio 2008 to Service Pack 1 to take advantage of the MFC enhacements (Feature Pack).

    I orginally had an MDI app in which I had changed the background in the main client area to tile a company logo. I originally followed the instructions in MSDN: Q129471. Worked beautifully since MS VS 2002 .NET.

    CMainFrame was derived from CMDIFrameWnd, and my overloaded CMainFrame::OnCreate() looked like

    Code:
         BOOL CMainFrame::CreateClient(LPCREATESTRUCT lpCreateStruct, CMenu* pWindowMenu)
         {
             if(CMDIFrameWnd::CreateClient(lpCreateStruct, pWindowMenu))
             {
                    m_MyMdiClientWnd.SubclassWindow(m_hWndMDIClient);
                    return TRUE;
              }
             else
                   return FALSE;
           }
    BUT, now with the CMainFrame derived from CMDIFrameWndEx, the call to SubclassWindow() causes a stack overflow.

    Someone else has had to come across this same issue!
    Last edited by ovidiucucu; July 12th, 2009 at 04:54 AM. Reason: added [CODE] tags

  2. #2
    ovidiucucu's Avatar
    ovidiucucu is offline Moderator/Reviewer Power Poster
    Join Date
    Feb 2003
    Location
    Iasi - Romania
    Posts
    8,060

    Re: SubclassWindow causes stack overflow in CMainFrame::OnCreate()

    Quote Originally Posted by spectre72 View Post
    [...]
    my overloaded CMainFrame::OnCreate() looked like

    Code:
         BOOL CMainFrame::CreateClient(LPCREATESTRUCT lpCreateStruct, CMenu* pWindowMenu)
    [...]
    CMainFrame::OnCreate and CMainFrame::CreateClient are different functions, isn't it?
    Ovidiu Cucu
    "When in Rome, do as Romans do."
    My likes on StumbleUpon
    Visit: Microsoft Virtual Academy
    Follow: https://twitter.com/#!/ovidiucucu
    My blog: http://codexpert.ro/blog/author/ovidiu-cucu/

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  


Windows Mobile Development Center


Click Here to Expand Forum to Full Width

This is a CodeGuru survey question.


Featured


HTML5 Development Center