From: David Ching on

"William" <port(a)mx15.freecom.ne.jp> wrote in message
news:O7iEz5Q9HHA.1416(a)TK2MSFTNGP03.phx.gbl...
> The problem has been solved by Q232845 at MSDN.
>
> William

Great find, and congrats on fixing this hair puller of a problem! :-)
Wouldn't it be nice if LoadDockState() or SaveDockState() would assert if it
saw more than 1 toolbar with the same ID?

-- David


From: Ajay Kalra on
This is a common problem and it appears you have found the solution(Distinct
IDs for each CControlBar). It has been asked here several times and you can
do a Google search on the group to find answers for problems such as these.

---
Ajay

"William" <port(a)mx15.freecom.ne.jp> wrote in message
news:%23wT$j2O9HHA.1484(a)TK2MSFTNGP06.phx.gbl...
> Env: WindowsXP, VC++6.00
>
> I am trying to make a MDI application with two dynamic toolbars. I did as
> follows,
>
> BOOL CTest1App::InitInstance()
> {
> //using *.ini to save the information
> LoadStdProfileSettings();
> }
>
> class CMainFrame : public CMDIFrameWnd
> {
> CToolBar m_wndToolBar;
> CToolBar m_wndToolBar2;
> }
>
> int CMainFrame::OnCreate(LPCREATESTRUCT lpCreateStruct)
> {
> 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_MAINFRAME))
> {
> TRACE0("Failed to create toolbar\n");
> return -1;
> }
>
> if (!m_wndToolBar2.CreateEx(this, TBSTYLE_FLAT, WS_CHILD | WS_VISIBLE |
> CBRS_TOP
> | CBRS_GRIPPER | CBRS_TOOLTIPS | CBRS_FLYBY | CBRS_SIZE_DYNAMIC) ||
> !m_wndToolBar2.LoadToolBar(IDR_MAINFRAME2))
> {
> TRACE0("Failed to create toolbar\n");
> return -1;
> }
>
> m_wndToolBar.EnableDocking(CBRS_ALIGN_ANY);
> m_wndToolBar2.EnableDocking(CBRS_ALIGN_ANY);
>
> EnableDocking(CBRS_ALIGN_ANY);
>
> DockControlBar(&m_wndToolBar, AFX_IDW_DOCKBAR_TOP);
> DockControlBar(&m_wndToolBar2, AFX_IDW_DOCKBAR_TOP);
>
> LoadBarState("ToolbarInf");
> }
>
> void CMainFrame::OnClose()
> {
> SaveBarState("ToolbarInf");
>
> CMDIFrameWnd::OnClose();
> }
>
> When I try to run it, I can change these positions. But when I exit it and
> run it again, m_wndToolBar2 is always at lept-top position.
>
> TIA
>
> William
>

First  |  Prev  | 
Pages: 1 2
Prev: CListCtrl transparent
Next: CPrintDialogEx problem