CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 9 of 9
  1. #1
    Join Date
    Mar 2009
    Posts
    5

    CMFCOutlookbar crash while adding tab

    Hello All,
    I need to add CMFCOutlookbar control in my application. I used MSDN help and successfully able to add this control in the new applications in VS2008. But when i tried the same in my existing application, its giving crash while adding tabs.
    Here is the code :
    m_wndOutlookBar.SetMode2003(FALSE);

    BOOL flag = m_wndOutlookBar.Create (_T("Shortcuts"), this, CRect (0, 0, 100, 200), ID_VIEW_NAVIGATION, WS_CHILD | WS_VISIBLE | CBRS_LEFT);
    CMFCOutlookBarTabCtrl* pOutlookBar = (CMFCOutlookBarTabCtrl*) m_wndOutlookBar.GetUnderlyingWindow ();
    flag = m_wndOutlookPane.Create (&m_wndOutlookBar, AFX_DEFAULT_TOOLBAR_STYLE, IDS_OUTLOOKBAR, AFX_CBRS_FLOAT | AFX_CBRS_RESIZE);
    // make the Outlook pane detachable (enable docking)
    m_wndOutlookPane.EnableDocking (CBRS_ALIGN_ANY);
    flag = m_wndOutlookPane.AddButton (IDR_MAINFRAME, _T("Open"), ID_FILE_OPEN);
    flag = pOutlookBar->IsMode2003();
    pOutlookBar->AddTab (&m_wndOutlookPane, _T("Normal"), (UINT) -1, TRUE); //Giving crash at this line
    pOutlookBar->AddTab (&m_wndOutlookPane, _T("Kernel"), (UINT) -1, TRUE);

    It would be very helpful if anybody gives me directions to fix this problem.
    Thanks in advance !!

  2. #2
    VictorN's Avatar
    VictorN is offline Super Moderator Power Poster
    Join Date
    Jan 2003
    Location
    Hanover Germany
    Posts
    20,395

    Re: CMFCOutlookbar crash while adding tab

    What is "crashing"? You app?, VS2008?
    And how is it crashing?
    Victor Nijegorodov

  3. #3
    Join Date
    Mar 2009
    Posts
    5

    Re: CMFCOutlookbar crash while adding tab

    Quote Originally Posted by VictorN View Post
    What is "crashing"? You app?, VS2008?
    And how is it crashing?
    Its giving exception. As its MDI application and im adding all this code in child frame....and im getting output as "Failed to create empty document" and if i comment this code application runs well.

  4. #4
    VictorN's Avatar
    VictorN is offline Super Moderator Power Poster
    Join Date
    Jan 2003
    Location
    Hanover Germany
    Posts
    20,395

    Re: CMFCOutlookbar crash while adding tab

    Where "in child frame"?
    And please, use code tags while posting code snippets. See http://www.codeguru.com/forum/misc.php?do=bbcode
    Victor Nijegorodov

  5. #5
    Join Date
    Mar 2009
    Posts
    5

    Re: CMFCOutlookbar crash while adding tab

    Quote Originally Posted by VictorN View Post
    Where "in child frame"?
    And please, use code tags while posting code snippets. See http://www.codeguru.com/forum/misc.php?do=bbcode
    sorry Victor i am not aware of code tags.

    I am calling that code in OnCreate of child frame.

    The same is working with new MFC application but not in my application.

  6. #6
    VictorN's Avatar
    VictorN is offline Super Moderator Power Poster
    Join Date
    Jan 2003
    Location
    Hanover Germany
    Posts
    20,395

    Re: CMFCOutlookbar crash while adding tab

    What is the difference between *your application* and a *new MFC application*?
    Victor Nijegorodov

  7. #7
    Join Date
    Mar 2009
    Posts
    5

    Re: CMFCOutlookbar crash while adding tab

    Quote Originally Posted by VictorN View Post
    What is the difference between *your application* and a *new MFC application*?
    Its already developed application and has 5 splitter windows created in child frame. One of the splitter window contains the main view, which display some list control. I am told to display outlookbar in that view and list under outlook bar.

    So outlookbar control display is the first step to do this task, where i am facing a problem.

  8. #8
    VictorN's Avatar
    VictorN is offline Super Moderator Power Poster
    Join Date
    Jan 2003
    Location
    Hanover Germany
    Posts
    20,395

    Re: CMFCOutlookbar crash while adding tab

    You didn't answer about any difference ...
    Well, then maybe you'll just copy your old code to the new created project which runs without problem with a new CMFCOutlookbar?
    Victor Nijegorodov

  9. #9
    Join Date
    Mar 2009
    Posts
    5

    Re: CMFCOutlookbar crash while adding tab

    Solved the problem.

    Problem was with main frame and child frame base classes. As project was started in VS2005, base classes were CMDIFrameWnd and CMDIChildWnd. I modified the code support extended classes and got it working.

    I dont know whats the actual reason but it seems to be compatibility issue while migration from VS2005 to VS2008.

    Thanks Victor for your time !!

    Good day guys !!!

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
  •  





Click Here to Expand Forum to Full Width

Featured