hello,
i have toolbar but pictures that are in arent transparent,
i mean how can i create toolbar that has one color transparent,
so the pictures shows ok..i searched msdn and i cant find it,
i know how to make toolbar itself transparent but how can image for toolbar have transparent color???
pleaseeee
thank you!!!
Posted on 2001-11-13 08:40:46 by aasd
Maybe this thread will help http://www.asmcommunity.net/board/index.php?topic=183

Unfortunately the pictures are lost but the code is still there.

Thomas
Posted on 2001-11-13 11:16:30 by Thomas
Hi, I can send you this little example, but you must know that:
1. It is written (well, cutted and pasted) in a hurry
2. It is written in C
3. It isn't commented (but it is quite simple)

-Edit-
Her... I have found a little bug on resize window... I have updated ZIP file.
Posted on 2001-11-14 17:00:59 by LuHa
Hi LuHa



I converted your code to masm


Here is the file


Regards,

Beyond2000!
Posted on 2002-07-13 15:04:44 by Beyond2000!
Nice! Will come the day I will start studing Win32Asm :rolleyes:.
After all C is not too bad (file size, at least):
ASM Version -> 8704 bytes
C Version -> 8736 bytes
But ASM version has a menu and a disabled button :grin:.
Posted on 2002-07-13 18:49:45 by LuHa
Thats kinda funny, I just ran into the very same problem not last week. I like the code posted above, always wondered about "hot" button handling. Very interesting.

I plan on switching over to something close to the above code, but feel free to use my alternate method I found if it suits your needs.



; #########################################################################
CreateToolBar proc hWnd:dword
local tba :TBADDBITMAP
local cm :COLORMAP

local hDC :dword
local BM :dword
local hOldBM :dword

; create the toolbar (ID of 300)
invoke CreateToolbarEx, hWnd, WS_VISIBLE or WS_CLIPCHILDREN or TBSTYLE_FLAT, 300, 16, 0, 0, 0, 0, 16, 16, 0, 0, sizeof TBBUTTON
mov hToolBar, eax
invoke ShowWindow, hToolBar, SW_SHOWNORMAL

; load the bitmap and set correct color mapping
invoke CreateCompatibleDC, 0
mov hDC, eax
invoke LoadBitmap, hInstance, RESOURCE_TOOLBAR_BITMAP
mov BM, eax

invoke SelectObject, hDC, BM
mov hOldBM, eax

invoke GetPixel, hDC, 0, 0
mov cm.From, eax
invoke GetSysColor, COLOR_BTNFACE
mov cm.To, eax
invoke CreateMappedBitmap, hInstance, RESOURCE_TOOLBAR_BITMAP, 0, ADDR cm, 1

; register bitmap strip with toolbar
mov tba.nID, eax
mov tba.hInst, 0
invoke SendMessage, hToolBar, TB_ADDBITMAP, 1, ADDR tba

; free resources
invoke SelectObject, hDC, hOldBM
invoke DeleteObject, BM
invoke DeleteDC, hDC

xor eax, eax
ret
CreateToolBar endp


I found CreateMappedBitmap in a reference a couple of days back. It automates some of the process. However through experimenting with it I have found it comes with a catch. Only (8 bit?) bitmaps can be used (16 colors). Therefore for all intents and putposes, the other code posted is better. If you send it a bitmap with greater resolution it will silently fail (no error but it wont do anything).
Posted on 2002-07-13 21:24:51 by Graebel