1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48
| //Création 1ere toolbar
if (!m_wndToolBar_1.CreateEx(this, TBSTYLE_FLAT, WS_CHILD | WS_VISIBLE | CBRS_TOP | CBRS_GRIPPER | CBRS_TOOLTIPS | CBRS_FLYBY | CBRS_SIZE_DYNAMIC) ||
!m_wndToolBar_1.LoadToolBar(IDR_MAINFRAME))
{
TRACE0("Failed to create toolbar 1\n");
return -1; // fail to create
}
//Création ème toolbar
if (!m_wndToolBar_2.CreateEx(this, TBSTYLE_FLAT, WS_CHILD | WS_VISIBLE | CBRS_TOP | CBRS_GRIPPER | CBRS_TOOLTIPS | CBRS_FLYBY | CBRS_SIZE_DYNAMIC) ||
!m_wndToolBar_2.LoadToolBar(IDR_MAINFRAME))
{
TRACE0("Failed to create toolbar 2\n");
return -1; // fail to create
}
// dockable 1
m_wndToolBar_1.EnableDocking(CBRS_ALIGN_ANY);
EnableDocking(CBRS_ALIGN_ANY);
DockControlBar(&m_wndToolBar_1);
// dockable 2
m_wndToolBar_2.EnableDocking(CBRS_ALIGN_ANY);
EnableDocking(CBRS_ALIGN_ANY);
DockControlBar(&m_wndToolBar_2);
// récuparation des 2 style GWL_STYLE et GWL_EXSTYLE
HWND TBwnd = m_wndToolBar_2.m_hWnd;
LONG TBlong_ex = GetWindowLong(TBwnd,GWL_EXSTYLE);
LONG TBlong = GetWindowLong(TBwnd,GWL_STYLE);
....
....
Et voici le code API:
HWND InitToolBar(HWND hWnd, HINSTANCE hInst, int Index)
{
// création barre d'outils
HWND m_hWndToolBar;
if (Index==1) { m_hWndToolBar = CreateWindowEx(0, TOOLBARCLASSNAME, NULL, WS_CHILD ,0 , 0, 0, 0, hWnd, 0,hInst, NULL); }
if (Index==2) { m_hWndToolBar = CreateWindowEx(0, TOOLBARCLASSNAME, NULL, WS_CHILD ,0 ,0 ,0 , 0, hWnd, 0,hInst, NULL); }
if(!m_hWndToolBar) return FALSE;
// ajout style TBSTYLE_FLAT (Pb quand fait lors de la création)
DWORD dwStyle = GetWindowLong(m_hWndToolBar, GWL_STYLE);
SetWindowLong(m_hWndToolBar, GWL_STYLE, 1409288270);
SetWindowLong(m_hWndToolBar, GWL_EXSTYLE, 0);
....
.... |
Partager