Hey Im having another problem with the toolbar creator for RADASM. Its not really a problem but more like me not knowing how to use it...When I create my toolbar this is the export code i get:


.const

IDC_NEW equ 10001
IDC_OPEN equ 10002
IDC_SAVE equ 10003
IDC_FIND equ 10004
IDC_FINDNEXT equ 10005
IDC_ADD equ 10006
IDC_SUBTRACT equ 10007
IDC_HELP equ 10008
IDC_ABOUT equ 10009

tbrbtns TBBUTTON <6,IDC_NEW,TBSTATE_ENABLED,TBSTYLE_BUTTON,0,0>
TBBUTTON <7,IDC_OPEN,TBSTATE_ENABLED,TBSTYLE_BUTTON,0,0>
TBBUTTON <8,IDC_SAVE,TBSTATE_ENABLED,TBSTYLE_BUTTON,0,0>
TBBUTTON <0,0,TBSTATE_ENABLED,TBSTYLE_SEP,0,0>
TBBUTTON <2,IDC_FIND,TBSTATE_ENABLED,TBSTYLE_BUTTON,0,0>
TBBUTTON <3,IDC_FINDNEXT,TBSTATE_ENABLED,TBSTYLE_BUTTON,0,0>
TBBUTTON <1,IDC_ADD,TBSTATE_ENABLED,TBSTYLE_BUTTON,0,0>
TBBUTTON <5,IDC_SUBTRACT,TBSTATE_ENABLED,TBSTYLE_BUTTON,0,0>
TBBUTTON <0,0,TBSTATE_ENABLED,TBSTYLE_SEP,0,0>
TBBUTTON <4,IDC_HELP,TBSTATE_ENABLED,TBSTYLE_BUTTON,0,0>
TBBUTTON <0,IDC_ABOUT,TBSTATE_ENABLED,TBSTYLE_BUTTON,0,0>
ntbrbtns equ 11

.code

DoToolBar proc hInst:DWORD,hToolBar:HWND
LOCAL tbab:TBADDBITMAP

;Set toolbar struct size
invoke SendMessage,hToolBar,TB_BUTTONSTRUCTSIZE,sizeof TBBUTTON,0
;Set toolbar bitmap
push hInst;<-- THIS IS THE PART IM HAVING TROUBLE WITH!!!
pop tbab.hInst
mov tbab.nID,IDB_STD_SMALL_COLOR
invoke SendMessage,hToolBar,TB_ADDBITMAP,15,addr tbab
;Set toolbar buttons
invoke SendMessage,hToolBar,TB_ADDBUTTONS,ntbrbtns,addr tbrbtns
mov eax,hToolBar
ret

DoToolBar endp


As you can see the part above ( push hInst;<-- THIS IS THE PART IM HAVING TROUBLE WITH!!!
) is the part Im having trouble with. When I change it to what you have in your richeditor example it shows up the toolbar you use in your example and not the one i made. But when i leave it as hInst it doesnt show anything. How would I get my toolbar to come up?? Any help is appreciated.

RIF
Posted on 2002-08-07 13:59:50 by resistance_is_futile
comeon guys!! lol I know you all are getting tired of me but what can I say Im learning lol.
Posted on 2002-08-07 20:29:05 by resistance_is_futile
Hi resistance_is_futile

Be patient. Your question is complex and involves a lot of things.

IDB_STD_SMALL_COLOR is an identifyer of a windows resource bitmap. To use it, tbab.hInst must be set to 0. If you want to use your own resource bitmap, then replace IDB_STD_SMALL_COLOR with the ID of your resource bitmap, and set tbab.hInst to the hInstance of your program.

KetilO
Posted on 2002-08-08 01:48:49 by KetilO
hey,
Yea I guess I have gotten so used to you guys being so quick at answering my questions that Ive gotten "spoiled" if you will lol. But thx. Can my ID be anything or does it have to be something specific. I know it cannot be the same as any other id.
Posted on 2002-08-08 13:56:33 by resistance_is_futile
Hi resistance_is_futile

In a dialog on win98 the ID can be 1 to 32767. The ID can not be the same as another bitmap, but can be the same as another control or even an icon.

KetilO
Posted on 2002-08-08 14:26:57 by KetilO
okay to get the bitmap to actually load in the menu do I have to specify anything in .const or .data or .data? ? If so what is it lol. Like I dont have to put anything about where the bitmap is located? Also I dont get by what you mean of change tbab.hInst to zero. How would i do that? because when I just delete all of it and put zero, it says it cannot do that?? "IDB_STD_SMALL_COLOR with the ID of your resource bitmap" how would I get the ID of the bitmap/make one for it??
Posted on 2002-08-08 20:00:54 by resistance_is_futile
okay this is my .rc file err the part that the bitmap uses im trying to get loaded as a menu:


IDB_STD_SMALL_COLOR2 BITMAP DISCARDABLE Res\bitmap.BMP
#define IDB_STD_SMALL_COLOR2 750


Here is my current .data/ .data? section:



.const
;toolbar button definitions
IDC_NEW equ 10001
IDC_OPEN equ 10002
IDC_SAVE equ 10003
IDC_FIND equ 10004
IDC_FINDNEXT equ 10005
IDC_ADD equ 10006
IDC_SUBTRACT equ 10007
IDC_ABOUT equ 10009
IDI_MAINICO equ 100
;structure for toolbar buttons
main equ 750

tbrbtns TBBUTTON <0,0,TBSTATE_ENABLED,TBSTYLE_SEP,0,0>
TBBUTTON <6,IDC_NEW,TBSTATE_ENABLED,TBSTYLE_BUTTON,0,0>
TBBUTTON <7,IDC_OPEN,TBSTATE_ENABLED,TBSTYLE_BUTTON,0,0>
TBBUTTON <8,IDC_SAVE,TBSTATE_ENABLED,TBSTYLE_BUTTON,0,0>
TBBUTTON <0,0,TBSTATE_ENABLED,TBSTYLE_SEP,0,0>
TBBUTTON <2,IDC_FIND,TBSTATE_ENABLED,TBSTYLE_BUTTON,0,0>
TBBUTTON <3,IDC_FINDNEXT,TBSTATE_ENABLED,TBSTYLE_BUTTON,0,0>
TBBUTTON <1,IDC_ADD,TBSTATE_ENABLED,TBSTYLE_BUTTON,0,0>
TBBUTTON <5,IDC_SUBTRACT,TBSTATE_ENABLED,TBSTYLE_BUTTON,0,0>
TBBUTTON <0,0,TBSTATE_ENABLED,TBSTYLE_SEP,0,0>
TBBUTTON <4,IDC_HELP,TBSTATE_ENABLED,TBSTYLE_BUTTON,0,0>
TBBUTTON <0,IDC_ABOUT,TBSTATE_ENABLED,TBSTYLE_BUTTON,0,0>
TBBUTTON <0,0,TBSTATE_ENABLED,TBSTYLE_SEP,0,0>
ntbrbtns equ 13

;main buttons
IDC_BTN1 equ 1001
IDC_LST1 equ 1002
IDC_BTN2 equ 1004
IDC_TBR equ 1005
IDC_BTN3 equ 1006
IDB_STD_SMALL_COLOR2 equ 750


.data

hIco dd 0
szToolBarClass db 'ToolbarWindow32',0



and here is my code:



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 or TBSTYLE_FLAT,0,0,0,0,hOwner,main,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_STD_SMALL_COLOR2
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
----------------------------------------------------------------------------------------------------------------------

WndProc proc hWin:HWND,uMsg:UINT,wParam:WPARAM,lParam:LPARAM

mov eax,uMsg
.if eax==WM_INITDIALOG
push hWin
pop hWnd
invoke GetDlgItem,hWin,IDC_TBR
invoke DoToolBar,hWin,eax
blah blah blah


Any help with this is very much appreciated..
Posted on 2002-08-09 15:17:43 by resistance_is_futile
Do the following changes;



DoToolBar proc hInst:DWORD,hOwner:HWND,hToolBar:DWORD
LOCAL tbab:TBADDBITMAP

;Set toolbar struct size
invoke SendMessage,hToolBar,TB_BUTTONSTRUCTSIZE,sizeof TBBUTTON,0
;Set toolbar bitmap
push hInst
pop tbab.hInst
mov tbab.nID,IDB_STD_SMALL_COLOR2
invoke SendMessage,hToolBar,TB_ADDBITMAP,16,addr tbab
;Set toolbar buttons
invoke SendMessage,hToolBar,TB_ADDBUTTONS,ntbrbtns,addr tbrbtns
ret

DoToolBar endp
----------------------------------------------------------------------------------------------------------------------

WndProc proc hWin:HWND,uMsg:UINT,wParam:WPARAM,lParam:LPARAM

mov eax,uMsg
.if eax==WM_INITDIALOG
push hWin
pop hWnd
invoke GetDlgItem,hWin,IDC_TBR
invoke DoToolBar,hInstance,hWin,eax
blah blah blah


KetilO
Posted on 2002-08-09 15:28:48 by KetilO
still does not display the bitmap :( :confused: :mad:
Posted on 2002-08-09 17:09:07 by resistance_is_futile
Hi resistance_is_futile

Post all your code in a zip and I will help you.

KetilO
Posted on 2002-08-10 01:56:18 by KetilO
here is my project...Hopefully you can get the tab bar to work.
Posted on 2002-08-10 13:39:27 by resistance_is_futile
got the toolbar to appear with..
push 0
invoke LoadBitmap, hInst, IDB_STD_SMALL_COLOR2

(hInst not 0x00400000 ? dont forget to destroy handles when exiting app)

also moved this before winmain..
invoke LoadIcon,hInstance,IDI_MAINICO
mov hIco,eax

and saved command line
mov CommandLine, eax

btw: code in zip crashed after compile.. on Win2K SP3 (ollydbg is broke on SP3.. :( )
Posted on 2002-08-10 16:38:09 by X05
Hi resistance_is_futile

In .rc file move this line one line up:

#define IDB_STD_SMALL_COLOR2 750

Also win98 gpf's with 24 bit bitmaps. Save it with 16 or 256 colors.

KetilO
Posted on 2002-08-10 16:48:08 by KetilO
Here is the working version.

KetilO
Posted on 2002-08-10 16:57:24 by KetilO
results from: "fixed code".. toolbar ok tho..

The instruction at "0x77e20670" referenced memory at "0x80500f47". The memory could not be "read".

Click on OK to terminate the program
Click on CANCEL to debug the program

...

crashs on Win2k SP2/SP3..

.. fixed when i put

invoke RtlZeroMemory, ADDR wc, sizeof wc

inside WinMain

(should we destroy icon to?)
Posted on 2002-08-10 17:13:33 by X05
okay i finally fixed it doing this:

1. moving #define IDB_STD_SMALL_COLOR2 750 up one line in the .rc file

2.saving the bitmap as a 256 color bitmap instead of 16.

thx alot for all the help. also i added "invoke RtlZeroMemory, ADDR wc, sizeof wc" to winmain. Maybe ill close the icon as well. thx again for al lyour help..
Posted on 2002-08-10 23:17:15 by resistance_is_futile