Solved

Add custom bitmap to new toolbar button

Posted on 2006-10-27
4
1,113 Views
Last Modified: 2009-05-20
There is an existing toolbar created with CreateToolBarEx and I have added a button after the creation of this toolbar with the TB_ADDBUTTONS message and a TBBUTTON struct containing my new button's information. I need to be able to modify the imagelist of this toolbar and add a custom bitmap to it, then assign my button this new image index which I would do in the iBitmap member of the TBBUTTON struct prior to adding my new button I would assume. I need some code which can do this because I am having problems doing this.

int2strcpy
0
Comment
Question by:int2strcpy
  • 2
4 Comments
 
LVL 9

Expert Comment

by:jhshukla
ID: 17824834
what development environment / IDE are you using?
0
 

Author Comment

by:int2strcpy
ID: 17825746
I'm using GCC on windows with Dev-C++ as an IDE.
0
 
LVL 9

Expert Comment

by:jhshukla
ID: 17828106
sorry buddy. not familiar with it.
0
 
LVL 5

Accepted Solution

by:
Rok Brnot earned 350 total points
ID: 17866351
define bitmap in .rc file
...
TB_ICN1  BITMAP "C:/Dev-Cpp/Icons/tb_icn1.bmp"
..
here is fragment of code from one of my progs, where I use custom tb icons
...
tbicn=LoadBitmap(hinst,"TB_ICN1");
dicn.hInst=NULL;
dicn.nID=(UINT)tbicn;
x=SendMessage(hwndToolBar,TB_ADDBITMAP,1,(LPARAM)&dicn);
x=SendMessage(hwndToolBar,TB_CHANGEBITMAP,ID_CMDTB1,(LPARAM)MAKELPARAM(15, 0));
...
0

Featured Post

NFR key for Veeam Backup for Microsoft Office 365

Veeam is happy to provide a free NFR license (for 1 year, up to 10 users). This license allows for the non‑production use of Veeam Backup for Microsoft Office 365 in your home lab without any feature limitations.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

An Outlet in Cocoa is a persistent reference to a GUI control; it connects a property (a variable) to a control.  For example, it is common to create an Outlet for the text field GUI control and change the text that appears in this field via that Ou…
This is a short and sweet, but (hopefully) to the point article. There seems to be some fundamental misunderstanding about the function prototype for the "main" function in C and C++, more specifically what type this function should return. I see so…
Video by: Grant
The goal of this video is to provide viewers with basic examples to understand and use for-loops in the C programming language.
Video by: Grant
The goal of this video is to provide viewers with basic examples to understand and use nested-loops in the C programming language.

840 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question