Element ToolBar BaseElements include 'Win.inc' EndBase GlobalConst PCharConst toolbar_class,'ToolbarWindow32' GlobalProc proc ToolBar.AddButtons hwnd,nButtons,pResNames locals bmp TBADDBITMAP btn TBBUTTON endl push esi edi xor edi,edi mov esi,[pResNames] mov [bmp.hInst],0 mov [btn.fsState],TBSTATE_ENABLED mov [btn.fsStyle],0 mov [btn.dwData],0 .loop: lodsd invoke LoadImage,[hinstance],eax,IMAGE_BITMAP,0,0,LR_DEFAULTSIZE or LR_LOADTRANSPARENT mov [bmp.nID],eax lea eax,[bmp] invoke SendMessage,[hwnd],TB_ADDBITMAP,1,eax mov [btn.iBitmap],edi mov eax,7000h add eax,edi mov [btn.idCommand],eax mov [btn.iString],edi lea eax,[btn] invoke SendMessage,[hwnd],TB_ADDBUTTONS,1,eax inc edi cmp edi,[nButtons] jb .loop pop edi esi ret endp LocalConst label Self#.Button.rc match n,Self#.prop.Buttons.count \{ rept n nButton \\{ dd Self#.prop.Buttons.data.\\#nButton \\} \} Create NewControl Self,Parent,toolbar_class,0,TBSTYLE_WRAPABLE+CCS_NORESIZE+CCS_NOPARENTALIGN invoke SendMessage,[Self#.hwnd],TB_BUTTONSTRUCTSIZE,sizeof.TBBUTTON,0 if Self#.prop.Buttons.count>0 invoke SendMessage,[Self#.hwnd],TB_ADDSTRING,0,Self#.prop.Buttons.names lea eax,[Self#.Button.rc] stdcall ToolBar.AddButtons,[Self#.hwnd],Self#.prop.Buttons.count,eax invoke SendMessage,[Self#.hwnd],TB_AUTOSIZE,0,0 end if Events if Self#.onClick.use eq 1 local next mov eax,[wparam] sub eax,7000h cmp eax,Self#.prop.Buttons.count jae next Self#.onClick eax,data_int,Parent#.finish jmp Parent#.finish next: end if PointWork doEnable \local res ToInteger res,data,data.type if res eqtype 0 mov eax,7000h+res else mov_ex eax,res add eax,7000h end if invoke SendMessage,[Self#.hwnd],TB_ENABLEBUTTON,eax,1 EndPoint PointWork doDisable \local res ToInteger res,data,data.type if res eqtype 0 mov eax,7000h+res else mov_ex eax,res add eax,7000h end if invoke SendMessage,[Self#.hwnd],TB_ENABLEBUTTON,eax,0 EndPoint EndElement