News:

Masm32 SDK description, downloads and other helpful links
Message to All Guests
NB: Posting URL's See here: Posted URL Change

Main Menu

load icon in toolbar

Started by 5k3l3t0r, June 03, 2012, 04:10:25 AM

Previous topic - Next topic

5k3l3t0r

hi all,
it is possible to load icons in toolbar?

i have some icon handles (HICON) and wish to set this as toolbar button image,but don't know how.

i have converted the icon to bitmap and load the bitmap in image list but the button comes black...

i have used this code to convert:

BitmapFromIcon proc _hIcon:HICON
local hDC:HDC
local hBitmap:HBITMAP
local hOldBitmap:HBITMAP
local cxIcon:DWORD
local cyIcon:DWORD

invoke CreateCompatibleDC,NULL
mov hDC,eax
invoke GetSystemMetrics,SM_CXICON
mov cxIcon,eax
invoke GetSystemMetrics,SM_CYICON
mov cyIcon,eax
invoke CreateCompatibleBitmap,hDC,cxIcon,cyIcon
mov hBitmap,eax

invoke SelectObject,hDC, hBitmap
mov hOldBitmap,eax
invoke DrawIcon,hDC, 0, 0, _hIcon
invoke SelectObject,hDC, hOldBitmap
invoke DeleteDC,hDC
mov eax,hBitmap

ret
BitmapFromIcon endp


tkx in advance

5k3l3t0r
===============================================================================================================
I have solved my problem with "ImageList_AddIcon" api...

tkx any way...

bye 5k3l3t0r

Removed [solved], this forum is not a help desk.