Adding bitmap images to toolbar buttons programmatically
-
Hi I am creating a toolbar for IE in ARL,COM and WTL.I want to add bitmap images to the toolbar buttons programmatically.previously I was adding the images on the toolbar buttons by hand drawing.But these images obviously do not look good.I want to add bitmap images to the buttons programmatically.Can anybody help me with code?Thanks in advance.
-
Hi I am creating a toolbar for IE in ARL,COM and WTL.I want to add bitmap images to the toolbar buttons programmatically.previously I was adding the images on the toolbar buttons by hand drawing.But these images obviously do not look good.I want to add bitmap images to the buttons programmatically.Can anybody help me with code?Thanks in advance.
/*Here, hInst is your HINSTANCE, like: HINSTANCE hInst = _Module.GetResourceInstance();*/ /*IDB_SOME is the resource ID of your new bitmap added to the project*/ /*hWnd is the HWND of the toolbar*/
TBADDBITMAP bmpNew; bmpNew.hInst = hInst; bmpNew.nID = IDB_SOME; ::SendMessage(hWnd,TB_ADDBITMAP,1,LPARAM(&bmpNew));
TBBUTTONINFO tb; memset(&tb,0,sizeof(TBBUTTON)); tb.cbSize = sizeof(TBBUTTONINFO); tb.dwMask = TBIF_IMAGE;
/*Here, set this number to the next value after the end of your bitmapped toolbar*/tb.iImage = 6;
/*ID_FIRST_BUTTON is the ID of the toolbar button you want to set the image of*/::SendMessage(hWnd,TB_SETBUTTONINFO,ID_FIRST_BUTTON,LPARAM(&tb));
this is this.