I've download .SWITCH macros of QvasiModo and bitRAKE from madwizard.org and included it to my source but it didn't run and lead me to a 'Syntax error' at .SWITCH in macro . Certainly I don't include two macro , just tried to include of QvasiModo first and after it fail I deleted it and inserted the one of bitRAKE.
It seems MASM don't accept macro start with the dot '.' :confused: :confused: :confused: :confused: :confused:
I used MASM 8.
Posted on 2003-10-17 00:00:28 by dreamweaver
Hi, dreamweaver.
I wouldn't know about BitRAKE's (they're much more complicated, and I didn't get the hang of the macro language enough to understand them), but I can tell you about my macros.
This is a sample of their usage:


WindowProc proc hWnd,uMsg,wParam,lParam

mov eax,uMsg
.switch eax
.case WM_COMMAND
;process WM_COMMAND here...
.break
.case WM_CREATE
;window initialization...
.break
.case WM_DESTROY
;note that .break is not necessary here, as the .switch is over
.endswitch
ret

WindowProc endp

Also you probably need to include this line before the macro definitions:
option dotname

Regards, :)
QvasiModo
Posted on 2003-10-17 12:19:38 by QvasiModo
Oh QvasiModi , thanks so much .
BTW , please you or anyone give me a detailed macro creating tutorial in MASM .
I really want learning macro because I don't understand anything when look into MASM macro ;)
Really hesitating but true. Perhap I'm too lazy .
Hope it will have a series of creating macro like Iczelion tutorials.

Edited :
QvasiModo , did you test it on MASM 8 and RadASM ???
It still not run ..
Error Code :


Assembling: bt11.asm
bt11.asm(42) : error A2044: invalid character in file
.case(27): Macro Called From
bt11.asm(42): Main Line Code
bt11.asm(46) : fatal error A1011: directive must be in control block
.case(13): Macro Called From
bt11.asm(46): Main Line Code
Make error(s) occured.


And MySource :


mov eax,uMsg
.switch eax
.case WM_INITDIALOG
invoke GetDlgItem,hWnd,IDC_EDIT
invoke SetFocus,eax
.break
.case WM_CLOSE
invoke SendMessage,hWnd,WM_COMMAND,IDM_EXIT,0
.break
.case WM_COMMAND
mov eax,wParam
.IF lParam==0
.IF ax==IDM_EXIT
invoke EndDialog,hWnd,NULL
.endif
.endif
.break
.default
mov eax,FALSE
ret
.endswitch
mov eax,TRUE
ret

It generate error on ".CASE" ...
Posted on 2003-10-17 22:17:12 by dreamweaver
This is really weird. There is nothing wrong with your code, and the macros should work fine (I use them in most of my sources). I think the only real error is the "invalid character in file", and the others are caused by the first (as the .case macro did not work correctly, causing the "directive must be in control block" errors when .if statements get screwed up). Just in case, here's a copy of the macros file I include in my projects. Try this one instead, and tell me how it worked.

Also, if the dot at the beggining of the macro name is the cause, try removing it...

As for the macros tutorial, I have never seen one (but I'de like to :grin: ). However there are the MASM manuals in PDF format somewhere, they contain the full macro reference (I'll google for a while and see what I can get). Also MASM32.HLP is helpful.
Posted on 2003-10-18 15:32:38 by QvasiModo
I really don't know what happen but your attachment macros works .
But the "switch macro" I have before and the "switch" from the attachment are the same ??? :stupid:
Though , final it works , and I'm happy :grin: :grin: :grin: Thanks so much :alright:
Posted on 2003-10-19 07:53:25 by dreamweaver

.SWITCH macros of QvasiModo and bitRAKE from madwizard.org

I get it now...
No, the macros are different. The file I've uploaded are my own version (much simpler), the one from madwizard.org is BitRAKE's original version (much more efficient, but more complicated).
Anyway, I'm glad your problem is solved. :)

BTW, this link could be useful:
http://webster.cs.ucr.edu/Page_TechDocs/MASMDoc/
:alright:
Posted on 2003-10-20 16:37:30 by QvasiModo