Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

You are subscribed to this thread Adding toolbar to MFC Application

Status
Not open for further replies.

Takhysis

Programmer
Sep 23, 2008
3
IT
Hi! :)

I would like to add a toolbar to my MFC application to show a tree structure, something like Visual Studio img146.imageshack.us.

I did some researches in MSDN documentation and I found "Dialog Bars".. is that the right tool I have to use to create my toolbar? I would like to be sure it is the right way before spending a lot of time googling around..

Thanks a lot! :) :) :)
(and sorry for my poor english)
 
Hi Takhysis

Add to the .h file.

Code:
CToolBar m_ToolBar;

Add to the dlg .cpp file in OnInitDialog()
Code:
if (!m_wndToolBar.CreateEx(this, TBSTYLE_FLAT, WS_CHILD | WS_VISIBLE | CBRS_TOP
	| CBRS_GRIPPER | CBRS_TOOLTIPS | CBRS_FLYBY | CBRS_SIZE_DYNAMIC) ||
	!m_wndToolBar.LoadToolBar(IDR_TOOLBAR1))
	{
		TRACE0("Failed to create toolbar\n");
		return -1;      // fail to create
	}

RepositionBars(AFX_IDW_CONTROLBAR_FIRST,AFX_IDW_CONTROLBAR_LAST,0);

In the Resources add a IDR_TOOLBAR1 toolbar object.

This will create a toolbar for a dialog based app MFC C++
 
Yes that will create a toolbar, but I don't need a toolbar with more buttons.. What I need is what someone calls "docking pane", a toolbar (preferably resizable) with a tree control inside, something like Visual Studio "Solution Explorer" pane (that's what I tried to link).
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top