Click to See Complete Forum and Search --> : Using bitmaps as a resource


rbettes
September 28th, 2010, 04:17 AM
am using Visual C++ and win32. The program is C++ and does not use the forms.

I created "pictures.RESX" file using the Resourcer program. The namespace name is instruction.resource

This created a file which contains all my bitmap files.

I have also managed to include this into my program using the resource facility in Visual C++ . I can view the bitmap files using the resource viewer.

What I am trying to do at the moment is access these bitmap files in the program. I have created a toolbar which I have used standard buttons and bitmaps. I now want to use my own bitmaps for the buttons.

I saw an example where I was told to define the bitmaps as:-

#define IDB_Btn0 3000

TBBUTTON tbb[3];
TBADDBITMAP tbab;

tbab.hInst = HINST_COMMCTRL;
tbab.nID = IDB_STD_SMALL_COLOR;

ZeroMemory(tbb, sizeof(tbb));
//********** NEW FILE BUTTON
tbb[0].iBitmap = IDB_Btn0 ;
tbb[0].fsState = TBSTATE_ENABLED;
tbb[0].fsStyle = TBSTYLE_BUTTON;
tbb[0].idCommand = MNU_INSERT_CONTACTS;


This is the code I am using what I am not sure of is do I need to address the bitmap files as part of the resource file "pictures.RESX" . This is being compiled into the Exe file.

I have been told that the tbab.nID is wrong and that tabb[0] should refere to an index of the bitmaps. How should I correct this. Do I need to define the resource filename in the program or will the names in the resource file be available (Btmp0.bmp,Btmp1.bmp,Btmp2.bmp etc)

Thanks

Eri523
September 28th, 2010, 07:36 AM
am using Visual C++ and win32. The program is C++ and does not use the forms.

So it is no C++/CLI program. I have seen you already have a thread on that topic over there in the Visual C++ forum (and got an answer there). This is the right place for the thread, so why don't you continue there?

rbettes
September 28th, 2010, 07:42 AM
Ok I did post it there but I haven't got a answer yet with regard to new question