Customizing a toolbar
-
I've used the following code to create the toolbar window:
hToolbar = CreateWindowEx(0,TOOLBARCLASSNAME,"MyToolbar",CCS_ADJUSTABLE|WS_CHILD|WS_VISIBLE|TBS_TOOLTIPS,0,0,0,0,hWnd/*this is a dialog*/,0,g_hInstance,NULL); SendMessage(hToolbar, TB_BUTTONSTRUCTSIZE, (WPARAM)sizeof(TBBUTTON), 0); SendMessage(hToolbar,TB_SETBITMAPSIZE, 0,(LPARAM)MAKELONG(32,32)); SendMessage(hToolbar, TB_AUTOSIZE,0,0);
I've added some bitmaps to the toolbar using several calls ofSendMessage(hToolbar,TB_ADDBITMAP,1,(LPARAM)&bit);
with bit of type TBADDBITMAP Finally added all my buttons to the toolbar usingSendMessage(hToolbar, TB_ADDBUTTONS, NUMBEROFTOOLBARBUTTONS, (LPARAM)&tbb);
I've added 5 buttons to the toolbar. The toolbar is perfectly visible and I've even managed to show a toolbar for each button by returning the appropriate data in the TTN_GETDISPINFO notification message. Now when I send the TB_CUSTOMIZE to the toolbar, I receive following notifications: TBN_BEGINADJUST: I simply return TRUE here Then 7(?!: I have only five buttons) TBN_QUERYINSERT notification I've printed the iItem value of the structure NMTOOLBAR for each notification: iItem = 5 iItem = 5 (why is this one send twice) iItem = 4 iItem = 3 iItem = 2 iItem = 1 iItem = 0 I return TRUE for each TBN_QUERYINSERT. And finally I get the notification TBN_ENDADJUST. Now where did the notifications TBN_QUERYDELETE and above all TBN_GETBUTTONINFO gone too?? I hope someone can help me out here, kind regards, Ward