CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 11 of 11
  1. #1
    Join Date
    May 1999
    Posts
    30

    How to attach a ToolBar to the main parent window

    Iam not using MFC AppWizard. I need to know How to attach a ToolBar to the main parent window.Can someone please help me out?


  2. #2
    Join Date
    Jun 1999
    Posts
    319

    Re: How to attach a ToolBar to the main parent window

    Try this one (I used a CReBar...) on the CMainFrame::OnCreate:

    [if (!m_wndReBar.Create(this))
    {
    TRACE0("Failed to create rebar\n");
    return -1; // fail to create
    }
    if (!m_wndToolBar1.CreateEx(this) ||
    !m_wndToolBar1.LoadToolBar(IDR_STANDARD))
    {
    TRACE0("Failed to create toolbar\n");
    return -1; // fail to create
    } ]
    where :
    [ CToolBar m_wndToolBar6;
    CReBar m_wndReBar;]
    If you need a special toolbar with some big buttons (like IE), you have a sample in the MSDN, called MSIE. Please let me know if it works or if you still have some problems.
    Regards,
    Fabi



  3. #3
    Join Date
    May 1999
    Posts
    30

    Re: How to attach a ToolBar to the main parent window

    Hi Fabi,
    I have a problem now. I have loaded this toolbar with a couple of buttons and one of them starts my application by creating a child window. ZThe problem is this child window HIDES MY LOADED TOOLBAR.


  4. #4
    Join Date
    Jun 1999
    Posts
    319

    Re: How to attach a ToolBar to the main parent window

    How can a window hide your toolbar? Anyway using the last code, you can add this:
    [ m_wndReBar.AddBar(&m_wndToolBar);]
    After this you can show a band with m_wndReBar.ShowBand(0);//now it has be visible. It is(reply)?

    Best regads,
    Fabi



  5. #5
    Join Date
    May 1999
    Posts
    30

    Re: How to attach a ToolBar to the main parent window

    Sorry I didn't tell you that Iam not Using CReBar but CToolBar. So I guess I cannot use AddBar() function.


  6. #6
    Join Date
    Jun 1999
    Posts
    319

    Re: How to attach a ToolBar to the main parent window

    Try with : toolbar.ShowWindow(SW_SHOW). Ok?


  7. #7
    Join Date
    May 1999
    Posts
    30

    Re: How to attach a ToolBar to the main parent window

    Nope!! Does,t work. Show I use GetClientRect() to reposition my child window or is there some other way. If you want to see my code ( to get a clear picture) I can email you.(if you have time for it)


  8. #8
    Join Date
    Jun 1999
    Posts
    319

    Re: How to attach a ToolBar to the main parent window

    Ok, send me your code. Try to make it shortly.


  9. #9
    Join Date
    Jun 1999
    Posts
    319

    Re: How to attach a ToolBar to the main parent window

    I forgot!!!!
    Let me eat your code, a couple of hours. I have a break. I'll eat it after. Ok?


  10. #10
    Join Date
    May 1999
    Posts
    30

    Re: How to attach a ToolBar to the main parent window

    But I need your email address for send you the code or do you want me to post them here itself?


  11. #11
    Join Date
    Jun 1999
    Posts
    319

    Re: How to attach a ToolBar to the main parent window

    My e-mail : [email protected]. Ok?


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