Solved

Add custom bitmap to new toolbar button

Posted on 2006-10-27
4
1,106 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

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

Have you thought about creating an iPhone application (app), but didn't even know where to get started? Here's how: ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ Important pre-programming comments: I’ve never tri…
Windows programmers of the C/C++ variety, how many of you realise that since Window 9x Microsoft has been lying to you about what constitutes Unicode (http://en.wikipedia.org/wiki/Unicode)? They will have you believe that Unicode requires you to use…
The goal of this video is to provide viewers with basic examples to understand and use structures in the C programming language.
The goal of this video is to provide viewers with basic examples to understand how to create, access, and change arrays in the C programming language.

706 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

Need Help in Real-Time?

Connect with top rated Experts

20 Experts available now in Live!

Get 1:1 Help Now