Repository navigation
docktool
Directory actions
More options
Directory actions
More options
docktool
Folders and files
| Name | Name | Last commit date | ||
|---|---|---|---|---|
parent directory.. | ||||
<!--TO READ THIS HELP FILE, RIGHT-CLICK ON THE FILE NAME IN THE
SOLUTION EXPLORER PANE AND SELECT "VIEW IN BROWSER"-->
<html><head><title>DOCKTOOL Sample: Demonstrates Dockable Toolbars</title></head><body><h1>DOCKTOOL Sample: Demonstrates Dockable Toolbars</h1><div id="mainSection"><div id="mainBody"><div id="allHistory" class="saveHistory" onsave="saveAll()" onload="loadAll()"></div><p /><p>The DOCKTOOL sample demonstrates support for dockable toolbars. A dockable toolbar can be attached, or docked, to any side of its parent window, or it can be detached, or floated, in its own miniframe window using <b>CMiniFrameWnd</b>. </p><div class="alert"><table width="100%" cellspacing="0" cellpadding="0"><tr><th align="left">Security Note </th></tr><tr><td><p>This sample code is provided to illustrate a concept and should not be used in applications or Web sites, as it may not illustrate the safest coding practices.</p></td></tr></table></div><h1 class="heading">Building and Running the Sample</h1><div id="sectionSection0" class="seeAlsoNoToggleSection"><h4 class="subHeading">To build and run the DOCKTOOL sample</h4><div class="subSection"><ol><li><p>Open the solution docktool.sln. </p></li><li><p>On the <b>Build</b> menu, click <b>Build</b>. </p></li><li><p>On the <b>Debug</b> menu, click <b>Start Without Debugging</b>. </p></li></ol></div></div><h1 class="heading">Supporting Dockable Toolbars</h1><div id="sectionSection1" class="seeAlsoNoToggleSection"><p>The following three steps are necessary to place a dockable toolbar in your application: </p><ol><li><p>Enable docking for the frame window or destination using the <b>CFrameWnd::EnableDocking</b> function. One <b>DWORD</b> parameter indicates which side of the frame window accepts docking. To dock control bars anywhere, pass <b>CBRS_ALIGN_ANY</b> to <b>EnableDocking</b>.</p></li><li><p>Enable docking for the toolbar or source by calling <b>CControlBar::EnableDocking</b> for each toolbar. Specify the destination sides to which the toolbar should dock. If none of the sides specified match the sides enabled for docking in the frame window, the toolbar cannot dock; it will float. Once it has been floated, it remains a floating toolbar, unable to dock to the frame window.</p></li><li><p>Dock the toolbar to the frame window by calling <b>CFrameWnd::DockControlBar</b>. Conversely, call <b>CFrameWnd::FloatControlBar</b> to detach a dockable toolbar from the frame window.</p></li></ol><p>If you do not complete all three steps, your application will display a standard toolbar. The last two steps must be performed for each dockable toolbar in your application.</p><p>To retain the state of dockable toolbars (whether docked or floating) between invocations of your application, use the <b>CControlBar::SetBarStyle</b> and <b>CControlBar::GetBarStyle</b> functions to retrieve and restore the settings of any particular control bar. Normally, this information is stored in the application's .ini file using <b>CFrameWnd::SaveBarState</b> and retrieved using <b>CFrameWnd::LoadBarState</b>.</p></div><h1 class="heading">Keywords</h1><div id="sectionSection2" class="seeAlsoNoToggleSection"><p>This sample demonstrates the following keywords:</p><p>AfxGetApp; CArchive::IsStoring; CComboBox::Create; CComboBox::DeleteString; CComboBox::GetCount; CComboBox::InsertString; CComboBox::SetCurSel; CControlBar::GetBarStyle; CControlBar::SetBarStyle; CDialog::DoModal; CDocument::OnNewDocument; CFrameWnd::Create; CFrameWnd::DockControlBar; CFrameWnd::EnableDocking; CFrameWnd::LoadBarState; CFrameWnd::RecalcLayout; CFrameWnd::SaveBarState; CMenu::GetSubMenu; CMenu::LoadMenu; CMenu::TrackPopupMenu; CObject::AssertValid; CObject::Dump; CObject::Serialize; CRect::OffsetRect; CString::IsEmpty; CToolBar::Create; CToolBar::GetItemRect; CToolBar::LoadBitmap; CToolBar::SetButtonInfo; CToolBar::SetButtons; CView::GetDocument; CView::OnDraw; CWinApp::AddDocTemplate; CWinApp::InitInstance; CWinApp::LoadStdProfileSettings; CWinApp::OnFileNew; CWnd::ClientToScreen; CWnd::DoDataExchange; CWnd::FromHandlePermanent; CWnd::GetParentFrame; CWnd::GetStyle; CWnd::GetWindowPlacement; CWnd::GetWindowRect; CWnd::GetWindowText; CWnd::Invalidate; CWnd::IsZoomed; CWnd::OnClose; CWnd::OnCreate; CWnd::PreTranslateMessage; CWnd::SendMessage; CWnd::SetWindowPlacement; CWnd::SetWindowPos; CWnd::SetWindowText; CWnd::ShowWindow; GetProfileInt; GetProfileString; GetStockObject; HIWORD; LOWORD; LoadBitmap; WriteProfileString; wsprintf</p><div class="alert"><table width="100%" cellspacing="0" cellpadding="0"><tr><th align="left">Note </th></tr><tr><td><p>Some samples, such as this one, have not been modified to reflect the changes in the Visual C++ wizards, libraries, and compiler, but still demonstrate how to complete your desired task. </p></td></tr></table></div></div></div><div id="footer"><div class="footerLine"></div>
© Microsoft Corporation. All rights reserved. Send <a href="mailto:DevDocs@microsoft.com?subject=Documentation Feedback :DOCKTOOL Sample: Demonstrates Dockable Toolbars">comments</a> about this topic to Microsoft.
</div></div></body></html>