的Win32 / C ++ 嗨我用几个按钮创建了工具栏:
TBBUTTON tbb[3];
TBADDBITMAP tbab;
tbab.hInst = HINST_COMMCTRL;
tbab.nID = IDB_STD_SMALL_COLOR;
SendMessage(hTool, TB_ADDBITMAP, 0, (LPARAM)&tbab);
ZeroMemory(tbb, sizeof(tbb));
tbb[0].iBitmap = STD_FILENEW;
tbb[0].fsState = TBSTATE_ENABLED;
tbb[0].fsStyle = TBSTYLE_BUTTON;
tbb[0].idCommand = ID_LAYER_1;
tbb[1].iBitmap = STD_FILEOPEN;
tbb[1].fsState = TBSTATE_ENABLED;
tbb[1].fsStyle = TBSTYLE_BUTTON;
tbb[1].idCommand = ID_LAYER_2;
tbb[2].iBitmap = STD_FILESAVE;
tbb[2].fsState = TBSTATE_ENABLED;
tbb[2].fsStyle = TBSTYLE_BUTTON;
tbb[2].idCommand = ID_LAYER_3;
hTool = GetDlgItem(hWnd, IDC_MAIN_TOOL);
hTool = CreateWindowEx(0, TOOLBARCLASSNAME, NULL, WS_CHILD | WS_VISIBLE, 0, 0, 0, 0, hWnd, (HMENU)IDC_MAIN_TOOL, GetModuleHandle(NULL), NULL);
SendMessage(hTool, TB_BUTTONSTRUCTSIZE, (WPARAM)sizeof(TBBUTTON), 0);
SendMessage(hTool, TB_ADDBUTTONS, sizeof(tbb)/sizeof(TBBUTTON), (LPARAM)&tbb);
现在我想在工具栏中添加轨迹栏或滑块?我怎样才能做到这一点?我在msdn中查找了工具栏信息,但除了按钮之外没有其他任何内容?
由于
答案 0 :(得分:5)
我在msdn上找到了:
http://msdn.microsoft.com/en-us/library/windows/desktop/hh298391(v=vs.85).aspx
toolbar
变量是工具栏的HWND
!
HWND track_bar = CreateWindowEx(NULL, TRACKBAR_CLASS,L"Trackbar",
WS_CHILD | WS_VISIBLE | TBS_AUTOTICKS | TBS_ENABLESELRANGE,
80, 0, 200, 40, toolbar, (HMENU)ID_TRACKBAR, hInst, NULL );