Author Topic: load icon in toolbar  (Read 4687 times)


  • Guest
load icon in toolbar
« on: June 03, 2012, 04:10:25 AM »
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:
Code: [Select]
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

BitmapFromIcon endp

tkx in advance

I have solved my problem with "ImageList_AddIcon" api...

tkx any way...

bye 5k3l3t0r

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

« Last Edit: June 04, 2012, 02:19:17 PM by hutch-- »