title: MFC floating toolbar always active
body: <p>I' m new with MFC. I needed to create a floating toolbar (CToolBar) with no option of docking and save and restore its last pos.</p>
  
  <p>The toolbar also should be active all the time, but its NOT.
  When I'm openning a new child window (dialog for instance) from the mainframe, the floating tool bar become not active (I can not click on its buttons, or drag it etc..).</p>
  
  <p>In the past I've used CDiaolog with Overlapped style and it was floating and always active as I needed. Is it possible to do the same with my Floating Toolbar? Thanks</p>
  
  <pre><code>int CMainFrame::OnCreate(LPCREATESTRUCT lpCreateStruct)
  {     
     if (CFrameWnd::OnCreate(lpCreateStruct) == -1)
     return -1;
  
     toolbarIconSize.cx = toolbarIconSize.cy = TOOLBAR_MAIN_ICON_SIZE;
     if ( !m_wndMyFloatingToolbar.Create(this,m_wndMyFloatingToolbar.GetBarStyle() |WS_EX_PALETTEWINDOW  | WS_EX_TOPMOST  |CBRS_FLOATING | WS_VISIBLE) ||
      !m_wndMyFloatingToolbar.LoadToolBar(IDR_GENERAL_TOOLBAR, toolbarIconSize))
      {
         TRACE0("Failed to create My Floating Toolbar\n");
         return -1;      // fail to create
      }
  
     m_wndMyFloatingToolbar.EnableDocking(0);
     EnableDocking(0);
  
     if (!CreateCtrlBar())
     {
         TRACE0("Failed to create ctrl toolbar\n");
         return -1;      // fail to create
     }
  
     // ...
     //...
     return 0; 
  }
  
  void CMainFrame::OnViewToolBar()
  {
     // ...
     //...
  
     CPoint Pos = MyFloatingToolbarGetLastPosition(); \\Get last pos 
     FloatControlBar( &amp;m_wndMyFloatingToolbar, Pos, CBRS_ALIGN_LEFT );
     MyFloatingToolbarSetIsVisible();
     FloatControlBar( &amp;m_wndMyFloatingToolbar, Pos, CBRS_ALIGN_LEFT );
  }
  void CMainFrame::MyFloatingToolbarSetIsVisible()
  {
     WINDOWPLACEMENT wp;
     m_wndMyFloatingToolbar.GetParent()-&gt;GetParent()-&gt;GetWindowPlacement(&amp;wp);
     wp.showCmd = SW_SHOW;
     m_wndMyFloatingToolbar.GetParent()-&gt;GetParent()-&gt;SetWindowPlacement(&amp;wp);
  
     m_wndMyFloatingToolbar.GetParent()-&gt;GetWindowPlacement(&amp;wp);
     wp.showCmd = SW_SHOW;
     m_wndMyFloatingToolbar.GetParent()-&gt;SetWindowPlacement(&amp;wp);
  
     m_wndMyFloatingToolbar.GetWindowPlacement(&amp;wp);
     wp.showCmd = SW_SHOW;
     m_wndMyFloatingToolbar.SetWindowPlacement(&amp;wp);
  }
  void CWJToolBar::OnWindowPosChanging(WINDOWPOS FAR* lpwndpos)
  { 
     CToolBar::OnWindowPosChanging(lpwndpos); 
  
     if ( GetBarStyle() &amp; CBRS_FLOATING )
     {
         if((lpwndpos-&gt;flags &amp; SWP_HIDEWINDOW) &amp;&amp; ((this-&gt;GetParentFrame())-&gt;m_hWnd !=(this-&gt;GetTopLevelFrame())-&gt;m_hWnd)) 
         { 
             CMainFrame* mf = (CMainFrame*)(AfxGetApp()-&gt;GetMainWnd());
             mf-&gt;MyFloatingToolbarSavePosition();         
         }
     }
  }
  </code></pre>