If I create a regular window ready to be a floating toolbar using WS_EX_TOOLWINDOW, how do I then get toolbar buttons onto it?
I'm using C and the Win32 API.
Thanks
This is a discussion on getting toolbar buttons onto a window within the Windows Programming forums, part of the Platform Specific Boards category; If I create a regular window ready to be a floating toolbar using WS_EX_TOOLWINDOW, how do I then get toolbar ...
If I create a regular window ready to be a floating toolbar using WS_EX_TOOLWINDOW, how do I then get toolbar buttons onto it?
I'm using C and the Win32 API.
Thanks
Open source isn't a matter of life or death......
.......its much more important than that!!
SuSE Linux - GCC 3.4.2
XP Pro - Visual Studio 2005 TS, MinGW 3.4.2
did you put in the window styles? such as WS_OVERLAPPEDWINOW or WS_SYSMENU on the toolwindow your declaring?
(im not sure what you mean)
Send a TB_INSERTBUTTON message to the toolbar window.
I'm not really sure where I'm going wrong here.
I'll post my relevant code sections on here in the hope that someone can point me in the right direction.
I'll use standard buttons to make it simpler
First of all, here is my simple button structure
Next I create my floating toolbar using WS_EX_TOOLWINDOW which successfully returns the handle hFloatTool.Code:TBBUTTON StdButtons [NUM_BUTTONS] = { /* iBitmap, idCommand, fsState, fsStyle, bReserved[2], dwData, iString */ {STD_FILENEW, ID_NEW, TBSTATE_ENABLED, TBSTYLE_BUTTON, {0}, 0, 0}, {STD_FILEOPEN, ID_OPEN, TBSTATE_ENABLED, BTNS_BUTTON, {0}, 0, 0}, {STD_FILESAVE, ID_SAVE, TBSTATE_INDETERMINATE, BTNS_BUTTON, {0}, 0, 0}, };
Then I attempt send the images to the toolbar
When run, I just get a blank floating toolbar.Code:/* Send the TB_BUTTONSTRUCTSIZE message, which is required for backward compatibility */ SendMessage(hFloatTool, TB_BUTTONSTRUCTSIZE, sizeof(TBBUTTON), 0); /* Add standard images */ tbab.hInst = HINST_COMMCTRL; tbab.nID = IDB_STD_SMALL_COLOR; iImageOffset = (INT)SendMessage(hFloatTool, TB_ADDBITMAP, NUM_BUTTONS, (LPARAM)&tbab); /* Add buttons to toolbar */ SendMessage(hFloatTool, TB_INSERTBUTTON, iImageOffset, (LPARAM) &StdButtons); /* Show toolbar */ ShowWindow(hFloatTool, SW_SHOW);
Any ideas?
Cheers.
Open source isn't a matter of life or death......
.......its much more important than that!!
SuSE Linux - GCC 3.4.2
XP Pro - Visual Studio 2005 TS, MinGW 3.4.2
should beCode:SendMessage(hFloatTool, TB_INSERTBUTTON, iImageOffset, (LPARAM) &StdButtons);The image offset is determined by the iBitmap member of the TBBUTTON structure, are you sure you're filling that correctly?Code:SendMessage(hFloatTool, TB_INSERTBUTTON, 0, (LPARAM) StdButtons[i]);