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 49 50 51 52 53 54 55 56
|
::INITCOMMONCONTROLSEX iccx = { 0 };
iccx.dwSize = sizeof(::INITCOMMONCONTROLSEX);
iccx.dwICC = ICC_STANDARD_CLASSES | ICC_WIN95_CLASSES | ICC_COOL_CLASSES;
::InitCommonControlsEx(&iccx);
::HWND g_hWndRebar = ::CreateWindowEx(
WS_EX_TOOLWINDOW,
REBARCLASSNAME,
NULL,
WS_CHILD | WS_VISIBLE | WS_CLIPSIBLINGS | WS_CLIPCHILDREN | RBS_VARHEIGHT | CCS_NODIVIDER,
0,0,0,0,
hWnd,
NULL,
g_hInstance,
NULL
);
if(!g_hWndRebar) {
throw(::GetLastError());
}
::REBARINFO rbInfo = { 0 };
rbInfo.cbSize = sizeof(::REBARINFO);
if(!::SendMessage(g_hWndRebar, RB_SETBARINFO, NULL, reinterpret_cast<::LPARAM>(&rbInfo))) {
throw(::GetLastError());
}
::HWND g_hWndMenuToolbar = ::CreateWindowEx(
WS_EX_TRANSPARENT,
TOOLBARCLASSNAME,
NULL,
WS_CHILD | WS_VISIBLE | TBSTYLE_FLAT | CCS_NOPARENTALIGN | CCS_NORESIZE | CCS_NODIVIDER,
0,0,0,0,
g_hWndRebar,
NULL,
g_hInstance,
NULL
);
if(!g_hWndMenuToolbar) {
throw(::GetLastError());
}
::SendMessage(g_hWndMenuToolbar, TB_BUTTONSTRUCTSIZE, static_cast<::WPARAM>(sizeof(::TBBUTTON)), NULL);
::REBARBANDINFO rbBand = { 0 };
rbBand.cbSize = sizeof(::REBARBANDINFO);
rbBand.fMask = RBBIM_CHILD | RBBIM_STYLE;
rbBand.fStyle = RBBS_CHILDEDGE | RBBS_VARIABLEHEIGHT | RBBS_GRIPPERALWAYS;
rbBand.hwndChild = g_hWndMenuToolbar;
rbBand.lpText = _T("");
if(!::SendMessage(g_hWndRebar, RB_INSERTBAND, static_cast<::WPARAM>(-1), reinterpret_cast<::LPARAM>(&rbBand))) {
throw(::GetLastError());//THROWS "ELEMENT NOT FOUND" ALWAYS!
}
|