Hi there,

i have a problem with the toolbar.i drop the rad toolbar from winasm studio on an dialog.
but where can i add buttons or seperators to the toolbar?

sorry for my bad english... :-(

can anybod send show me how to use the toolbar?

thx
Tenshi
Posted on 2004-03-31 10:31:29 by Tenshi
Hi Tenshi and welcome,

I suppose you are used to how High level languages let you "play" with the buttons of toolbars at design time. Add/delete etc buttons is not possible in TRUE resource editors like the one built-in WinAsm Studio. A TRUE resource editor allows you to add Dialogs/controls, edit their styles, dimensions, Caption. It's your responsibility to send API messages to your control with code to get the results you want.

Attached is a demo application that shows how to do this and MANY more.

I hope my answer helps. Please let me know.

Regards,

akyprian
Posted on 2004-04-01 06:28:24 by akyprian
Hi,

and thanks :)

you are right....i normally programm in c/c++ and delphi.
but i think asm is more intressting as those....so i startet assambler :)
Posted on 2004-04-01 06:35:44 by Tenshi
I actually believe that Assembly is much easier than many people believe. I would dare to say that it is easier than C++ provided you grasp the concept.

Enjoy FULL flexibility with Assembly!

akyprian
Posted on 2004-04-01 06:40:56 by akyprian
THX,

it works fine ;)

but i have used an other way to build it up....


.code

start:

invoke GetModuleHandle, NULL
mov hInstance,eax
invoke DialogBoxParam, hInstance, 1001 , NULL, addr MainProc, NULL
invoke ExitProcess, eax

;-------------------------------------------------------------------------------
; MainProc
;-------------------------------------------------------------------------------
MainProc proc hWnd:HWND, uMsg:UINT, wParam:WPARAM, lParam:LPARAM
.IF uMsg==WM_INITDIALOG
Invoke SendDlgItemMessage,hWnd,1016,TB_BUTTONSTRUCTSIZE,SizeOf TBBUTTON,0
Invoke SendDlgItemMessage,hWnd,1016,TB_ADDBUTTONS,4,ADDR tbMain
.ELSEIF uMsg==WM_CLOSE
invoke SendMessage, hWnd, WM_CLOSE, 0, 0
.ELSEIF uMsg==WM_COMMAND

.ELSE
mov eax,FALSE
ret
.ENDIF
mov eax,TRUE
ret
MainProc endp


end start


is it ok so too??
at the moment there are no bitmaps in it but it works so fine :)
Posted on 2004-04-01 06:47:08 by Tenshi
As already said: You have full flexibility. Usually there are many different ways to achieve the same (or similar) result.

Regards,

akyprian
Posted on 2004-04-01 09:18:28 by akyprian
thanks for your help :)
Posted on 2004-04-02 01:33:36 by Tenshi
Don't mention.

If you want you can post the basic work here so that we all use it as a template. Also, I will upload it to the site.

Regards,

akyprian
Posted on 2004-04-02 01:41:15 by akyprian
Hi again,

i have finished the toolbar template, i hope its good :-)

if you miss somthing our you think that somthing i have done ist not correct or bad asm coding please let me know :)

thx
Tenshi
Posted on 2004-04-02 08:54:03 by Tenshi
Hi,

Very Good.
A couple of points:

a)Dialog boxes created by the DialogBox, DialogBoxParam, DialogBoxIndirect, and DialogBoxIndirectParam functions must be destroyed using the EndDialog function. An application calls EndDialog from within the dialog box procedure; the function must not be used for any other purpose.

So in your code:
.ELSEIF uMsg == WM_CLOSE
;Invoke SendMessage, hWnd, WM_CLOSE, 0, 0 <-----Commented-Causes a GPF on my Win98SE machine

instead, use:
Invoke EndDialog,hWnd,NULL

b)I always prefer to use ImageList_Destroy to destroy my image lists before application quits.

c)I always check HIWORD of wParam in WM_COMMAND. I suggest you do the same

.ElseIf uMsg==WM_COMMAND
HIWORD wParam
.If EAX == 0 || 1 ; 0 is a menu, 1 is an accelerator. Toolbar messages act like menu messages...
LOWORD wParam
.If AX==....
.ElseIf AX==...
..

Regards,

akyprian
Posted on 2004-04-02 13:59:23 by akyprian
hi again :),

thanks for your help i have only one question to your points....

c....
why should i check the hiword of wParam,
may be its an stupid question but i programm asm a feew week ago and dont understand why i should do it :)

tenshi
Posted on 2004-04-05 02:24:24 by Tenshi
Hi,

Most probably there will be controls on your dialogs, so it is a good practice to distinguish between notifications arriving from menus/accelerators/toolbars and controls.

WM_COMMAND
wNotifyCode = HIWORD(wParam); // notification code
wID = LOWORD(wParam); // item, control, or accelerator identifier
hwndCtl = (HWND) lParam; // handle of control


Parameters

wNotifyCode
Value of the high-order word of wParam. Specifies the notification code if the message is from a control. If the message is from an accelerator, this parameter is 1. If the message is from a menu, this parameter is 0.

I hope it helps.

Please make the appropriate changes to your toolbar demo and post it again so that I upload it to my site.

Regards,

akyprian
Posted on 2004-04-05 03:56:37 by akyprian
ok i have done the changes....
i hope its ok so now :)

tenshi
Posted on 2004-04-05 04:11:00 by Tenshi
Hi

This is wrong:
Invoke ImageList_Destroy, ToolBarImage

It should be:
Invoke ImageList_Destroy, hImgList

Regards,

akyprian
Posted on 2004-04-05 04:41:13 by akyprian
ohhh,

iam sorry

here it is :)
Posted on 2004-04-05 05:08:47 by Tenshi
Hi,

Are you sure your sample compiles?????? (definately NOT)

Replace
Invoke ImageList_Destroy, hImageList

with
Invoke ImageList_Destroy, hImgList

Regards,

akyprian
Posted on 2004-04-05 05:13:46 by akyprian
ohh man,

today is not my day......
iam sorry for that.....
i hope this is better now
Posted on 2004-04-05 05:25:31 by Tenshi
Fine!

Uploaded to my site, thanks

akyprian
Posted on 2004-04-05 05:55:09 by akyprian