D
Dan Moos
Guest
Here is my function for the toolbar creation. Image is a bitmap created with VS toolbar editor. Also, I'm unclear how the linker associates my bitmap with the #define in the .h file. Some magic when the .rc file is linked in?
void c_CharEditWindow::Toolbar()
{
HIMAGELIST g_hImageList = NULL;
hwndToolbar = CreateWindowEx(0, TOOLBARCLASSNAME, NULL, WS_CHILD | TBSTYLE_WRAPABLE,
0, 0, 0, 0, m_hwnd, NULL, GetModuleHandle(NULL), NULL);
g_hImageList = ImageList_Create(22, 22, ILC_COLOR16 | ILC_MASK, 4, 0);
SendMessage(hwndToolbar, TB_SETIMAGELIST, 0, (LPARAM)g_hImageList);
SendMessage(hwndToolbar, TB_LOADIMAGES, (WPARAM)IDR_TOOLBAR1, (LPARAM)GetModuleHandle(NULL));
TBBUTTON tbButtons[4] = {
{ID_BUTTON40002, WM_MOVE, TBSTATE_ENABLED, BTNS_AUTOSIZE, {0}, 0, NULL },
{ MAKELONG(ID_BUTTON40003, 0), WM_MOVE, TBSTATE_ENABLED, BTNS_AUTOSIZE, { 0 }, 0, NULL },
{ MAKELONG(ID_BUTTON40004, 0), WM_MOVE, TBSTATE_ENABLED, BTNS_AUTOSIZE, { 0 }, 0, NULL },
{ MAKELONG(ID_BUTTON40005, 0), WM_MOVE, TBSTATE_ENABLED, BTNS_AUTOSIZE,{ 0 }, 0, NULL }
};
SendMessage(hwndToolbar, TB_BUTTONSTRUCTSIZE, (WPARAM)sizeof(TBBUTTON), 0);
SendMessage(hwndToolbar, TB_ADDBUTTONS, 4, (LPARAM)&tbButtons);
SendMessage(hwndToolbar, TB_AUTOSIZE, 0, 0);
ShowWindow(hwndToolbar, TRUE);
}
I only get blank buttons.
Continue reading...
void c_CharEditWindow::Toolbar()
{
HIMAGELIST g_hImageList = NULL;
hwndToolbar = CreateWindowEx(0, TOOLBARCLASSNAME, NULL, WS_CHILD | TBSTYLE_WRAPABLE,
0, 0, 0, 0, m_hwnd, NULL, GetModuleHandle(NULL), NULL);
g_hImageList = ImageList_Create(22, 22, ILC_COLOR16 | ILC_MASK, 4, 0);
SendMessage(hwndToolbar, TB_SETIMAGELIST, 0, (LPARAM)g_hImageList);
SendMessage(hwndToolbar, TB_LOADIMAGES, (WPARAM)IDR_TOOLBAR1, (LPARAM)GetModuleHandle(NULL));
TBBUTTON tbButtons[4] = {
{ID_BUTTON40002, WM_MOVE, TBSTATE_ENABLED, BTNS_AUTOSIZE, {0}, 0, NULL },
{ MAKELONG(ID_BUTTON40003, 0), WM_MOVE, TBSTATE_ENABLED, BTNS_AUTOSIZE, { 0 }, 0, NULL },
{ MAKELONG(ID_BUTTON40004, 0), WM_MOVE, TBSTATE_ENABLED, BTNS_AUTOSIZE, { 0 }, 0, NULL },
{ MAKELONG(ID_BUTTON40005, 0), WM_MOVE, TBSTATE_ENABLED, BTNS_AUTOSIZE,{ 0 }, 0, NULL }
};
SendMessage(hwndToolbar, TB_BUTTONSTRUCTSIZE, (WPARAM)sizeof(TBBUTTON), 0);
SendMessage(hwndToolbar, TB_ADDBUTTONS, 4, (LPARAM)&tbButtons);
SendMessage(hwndToolbar, TB_AUTOSIZE, 0, 0);
ShowWindow(hwndToolbar, TRUE);
}
I only get blank buttons.
Continue reading...