Why isnt my Toolbar bitmpap showing?

Using Radasm / Masm32.
I changed the default toolbar bitmap (from Radasm) with my own one
links with no errors, but the bitmap doesnt appear.

Attached is my code (its small dont worry).


thanks alot

ranma
Posted on 2003-10-06 03:58:55 by Ranma_at
Hi,

You should not use IDB_STD_SMALL_COLOR since you have your own bmp file.
If you check Windows.inc you will discover

IDB_STD_SMALL_COLOR equ 0. So in your DoToolbar procedure:

;Set toolbar bitmap
push hInst
pop tbab.hInst

;Here I use 1000 because I use 1000 for WordEditT.bmp in your TestRes.rc file as well.

mov tbab.nID,1000;IDB_STD_SMALL_COLOR
invoke SendMessage,hToolBar,TB_ADDBITMAP,1,addr tbab


Regards,

akyprian
Posted on 2003-10-06 08:25:18 by akyprian
Hi Ranma_at,

The TB_ADDBITMAP method basically sucks. There are a few limitations to it such as only partial support for color depths greater than 8 bit (256 color) and a lack of control over the transparency colors. You are better off using the following method to load a toolbar image:
invoke ImageList_LoadImage, hInstance, 1000, 16, 256, TranspColor, IMAGE_BITMAP, LR_CREATEDIBSECTION

mov hIml, eax
invoke SendMessage, hToolBar, TB_SETIMAGELIST, 0, hIml

In the example 16 is the height of the toolbar images, 256 is the maximum number of images the imagelist can grow. The TranspColor can be any color you choose not just the color of the bottom/left pixel (in a bottom up DIB opposite in a top down). Creating the bitmap as a DIB section will speed up redraws.
Posted on 2003-10-06 08:56:15 by donkey
thanks alot again akyprian and Donkey


its working now, didnt know i shouldt use the default. :grin:
Posted on 2003-10-06 09:03:11 by Ranma_at
Fully agree with Donkey's approach. You better use it.

Regards,

akyprian
Posted on 2003-10-06 09:03:25 by akyprian
Thank you so much Donkey! I'm glad I read this thread becasue that solved a problem I've been struggeling with for a week now :alright:
Posted on 2003-10-06 15:41:40 by Delight