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?
Printable View
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?
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
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.
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
Sorry I didn't tell you that Iam not Using CReBar but CToolBar. So I guess I cannot use AddBar() function.
Try with : toolbar.ShowWindow(SW_SHOW). Ok?
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)
Ok, send me your code. Try to make it shortly.
I forgot!!!!
Let me eat your code, a couple of hours. I have a break. I'll eat it after. Ok?
But I need your email address for send you the code or do you want me to post them here itself?
My e-mail : [email protected]. Ok?