?
Solved

Add custom bitmap to new toolbar button

Posted on 2006-10-27
4
Medium Priority
?
1,117 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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 1400 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

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

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…
Preface I don't like visual development tools that are supposed to write a program for me. Even if it is Xcode and I can use Interface Builder. Yes, it is a perfect tool and has helped me a lot, mainly, in the beginning, when my programs were small…
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 use strings and some functions related to them in the C programming language.
Suggested Courses
Course of the Month12 days, 4 hours left to enroll

752 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