Below is the toolbar.rc file created by Radasm using Radasm Toolbar Creator and a bitmap from file. The problem is that the bitmap does not show when ran. I have looked for hours on this site and have not located a reasonable answer. I have seen a lot of places where an example file is supposed to be, but the links are missing.
Code to initialize the toolbar:
This is the code generated by Radasm Toolbar Creator export.
Thanks...
Tbr=IDC_TBR1,1001,0
Bmp=Res\Add.bmp,IDB_ADD,16 ; Here is the bitmap in the resource folder and the ID I gave it in the creator.
Mnu=
Size=16
0=IDC_TBB,1002,0,0
Code to initialize the toolbar:
.if eax==WM_INITDIALOG
push hWin
pop hWnd
mov hToolBar,rv(GetDlgItem,hWnd,IDC_TBR1)
invoke DoToolBar,hInstance,hWnd
This is the code generated by Radasm Toolbar Creator export.
DoToolBar proc hInst:DWORD,hOwner:HWND
LOCAL tbab:TBADDBITMAP
; LOCAL hToolBar:HWND
;Create the toolbar
; invoke CreateWindowEx,0,addr szToolBarClass,0,WS_CHILD or WS_VISIBLE,0,0,0,0,hOwner,IDC_TBR1,hInst,0
; mov hToolBar,eax
;Set toolbar struct size
invoke SendMessage,hToolBar,TB_BUTTONSTRUCTSIZE,sizeof TBBUTTON,0
;Set toolbar bitmap
push hInst
pop tbab.hInst
mov tbab.nID,IDB_ADD
invoke SendMessage,hToolBar,TB_ADDBITMAP,16,addr tbab
;Set toolbar buttons
invoke SendMessage,hToolBar,TB_ADDBUTTONS,ntbrbtns,addr tbrbtns
mov eax,hToolBar
ret
DoToolBar endp
Thanks...
Decrease color depth of "add.bmp" or use ImageList.
;; a toolbar with 1 48x48 bmp button
DoToolBar proc hToolBar:HWND
LOCAL himl:HIMAGELIST
LOCAL tbab:TBADDBITMAP
;Set toolbar struct size
invoke SendMessage,hToolBar,TB_BUTTONSTRUCTSIZE,sizeof TBBUTTON,0
invoke SendMessage,hToolBar,TB_SETBUTTONSIZE,0,MAKELONG(48,48)
invoke SendMessage,hToolBar,TB_SETBITMAPSIZE,0,MAKELONG(48,48)
invoke SendMessage,hToolBar,TB_SETMAXTEXTROWS,0,0
invoke GetModuleHandle,0
;Set toolbar bitmaps
invoke ImageList_LoadImage,eax,IDR_TBRBMP,48,1,RGB(255,0,255),IMAGE_BITMAP,LR_CREATEDIBSECTION
mov himl,eax
invoke SendMessage,hToolBar,TB_SETIMAGELIST,0,himl
;Set toolbar buttons
invoke SendMessage,hToolBar,TB_ADDBUTTONS,ntbrbtns,addr tbrbtns
mov eax,hToolBar
ret
DoToolBar endp