Skip to main content
GameDev.net gamedev.net
🔒 Locked

win32 toolbars

Started by knownonlyash May 4, 2004 at 6:37 AM 0 replies 1.1k views
Original Post
knownonlyash
knownonlyash
Hi is it possible to have standard a win32 toolbar (NEW, OPEN, SAVE) and your own custom toolbar next to it. I can get a one toolbar working but not both at the same time. my code is

hTool = CreateWindowEx(0, TOOLBARCLASSNAME, NULL, WS_CHILD | WS_VISIBLE, 0, 0, 0, 0,
						hWnd, (HMENU)IDC_MAIN_TOOL, GetModuleHandle(NULL), NULL);

		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_CURVES_BEZIER;

		tbb[1].iBitmap = STD_FILEOPEN;
		tbb[1].fsState = TBSTATE_ENABLED;
		tbb[1].fsStyle = TBSTYLE_BUTTON;
		tbb[1].idCommand = ID_CURVES_BEZIER;

		tbb[2].iBitmap = STD_FILESAVE;
		tbb[2].fsState = TBSTATE_ENABLED;
		tbb[2].fsStyle = TBSTYLE_BUTTON;
		tbb[2].idCommand = ID_CURVES_BEZIER;

		SendMessage(hTool, TB_ADDBUTTONS, sizeof(tbb)/sizeof(TBBUTTON), (LPARAM)&tbb);

which is just from forgers win32 tutorial and this loads the standard toolbar whilst the code to load my own toolbar is

hTool = CreateWindowEx(0, TOOLBARCLASSNAME, NULL, WS_CHILD | WS_VISIBLE, 0, 0, 0, 0,
						hWnd, (HMENU)IDC_MAIN_TOOL, GetModuleHandle(NULL), NULL);
		if(hTool == NULL)
			MessageBox(hWnd, "Could not create tool bar.", "Error", MB_OK | MB_ICONERROR);

		// Send the TB_BUTTONSTRUCTSIZE message, which is required for

		// backward compatibility.

		SendMessage(hTool, TB_BUTTONSTRUCTSIZE, (WPARAM)sizeof(TBBUTTON), 0);

extbab.hInst = (HINSTANCE)GetWindowLong(hWnd, GWL_HINSTANCE);
		extbab.nID = IDR_TOOLBAR1;
		SendMessage(hTool, TB_ADDBITMAP, (WPARAM)1, (LPARAM)&extbab);
		
		ZeroMemory(extra, sizeof(extra));
        extra[0].iBitmap = 0; 
        extra[0].idCommand = ID_TSURFACEOFREVOLUTION; 
        extra[0].fsState = TBSTATE_ENABLED; 
        extra[0].fsStyle = TBSTYLE_BUTTON; 

        SendMessage(hTool, TB_ADDBUTTONS, 1, (LPARAM)&extra);

if i try to create two windows then they just overlap each other thanks in advance

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.