News:

MASM32 SDK Description, downloads and other helpful links
MASM32.com New Forum Link
masmforum WebSite

insert drives on toolbar problem

Started by ragdog, July 13, 2007, 06:40:43 PM

Previous topic - Next topic

ragdog

hi guys

i have a problem to draw drives in my toolbar my algo draw only one icon in the toolbar

can your help me

dotoolbar proc drive:dword,id:dword
LOCAL  tbb      :TBBUTTON
LOCAL  sfi:SHFILEINFO
LOCAL  hImageList :DWORD

      invoke SHGetFileInfo,drive, 0, addr sfi, sizeof SHFILEINFO,\
                       SHGFI_SYSICONINDEX or SHGFI_ICON or SHGFI_SMALLICON

      invoke ImageList_Create, 32, 32, ILC_COLOR32 or ILC_MASK, 24, 48
         mov hImageList, eax
      invoke ImageList_AddIcon, hImageList,  sfi.hIcon
      invoke SendMessage,hToolbar,TB_BUTTONSTRUCTSIZE,sizeof TBBUTTON,0
      invoke SendMessage, hToolbar, TB_SETIMAGELIST, 0, hImageList
   
         mov edi,id
      TBButt hToolbar, 0, edi, offset AppName

      invoke RtlZeroMemory,addr hImageList,sizeof hImageList
      invoke RtlZeroMemory,addr sfi,sizeof SHFILEINFO
         mov eax,hToolbar
          ret
dotoolbar endp


example as jpg is attached in the zip file


greets in forward
ragdog

[attachment deleted by admin]

u

ImageList_Create and TB_SETIMAGELIST ... you should call them only once, not every time you add a drive.
Please use a smaller graphic in your signature.

ragdog

thx for the info

i have change to:

.if uMsg==WM_INITDIALOG

            invoke GetDlgItem,hWnd,1001
               mov hToolbar,eax
            invoke ImageList_Create, 32, 32, ILC_COLOR32 or ILC_MASK, 24, 48
               mov hImageList, eax
            invoke SendMessage,hToolbar,TB_BUTTONSTRUCTSIZE,sizeof TBBUTTON,0

            invoke SendMessage, hToolbar, TB_SETIMAGELIST, 0, hImageList
         
            invoke dotoolbar,driveicon1,1
            invoke dotoolbar,driveicon2,2

....
......

dotoolbar proc drive:dword,id:dword
LOCAL  tbb      :TBBUTTON
LOCAL  sfi:SHFILEINFO
LOCAL  hImageList :DWORD

      invoke SHGetFileInfo,drive, 0, addr sfi, sizeof SHFILEINFO,\
                       SHGFI_SYSICONINDEX or SHGFI_ICON or SHGFI_SMALLICON

   
         mov edi,id
      TBButt hToolbar, 0, edi, offset AppName

      invoke RtlZeroMemory,addr hImageList,sizeof hImageList
      invoke RtlZeroMemory,addr sfi,sizeof SHFILEINFO
         mov eax,hToolbar
          ret
dotoolbar endp



this display  2* the first icon driveicon1 not driveicon2   :'(

greets
ragdog

ragdog