Could someone show me how to write the messegeloop section below in old fashions style.. The Push and Call Method... I tried a lot of ways with no success... I get the window but when I move the cursor to it, it close.

###################################

.data

MSG STRUCT
hWnd DWORD ?
message DWORD ?
wParam DWORD ?
lParam DWORD ?
time DWORD ?
pt DWORD ?
MSG ENDS

; ####################################

;
.code
start:

WinMain proc hInst :DWORD,
hPrevInst :DWORD,
CmdLine :DWORD,
CmdShow :DWORD

;====================
; Put LOCALs on stack
;====================

LOCAL wc :WNDCLASSEX
LOCAL msg :MSG



;===================================
; Loop until PostQuitMessage is sent
;===================================

StartLoop:


;;;;;;;;;; invoke GetMessage,ADDR msg,NULL,0,0

PUSH 0
PUSH 0
PUSH NULL
PUSH msg.message
CALL GetMessage

cmp eax, 0
je ExitLoop

invoke TranslateMessage, ADDR msg
invoke DispatchMessage, ADDR msg
jmp StartLoop

ExitLoop:

return msg.wParam

WinMain endp

Thanks
Posted on 2002-02-11 08:43:02 by cmax
The following is a snippet from one of my code(Works in TASM).




[size=9]
@@Messages:

push NULL
push NULL
push NULL
push OFFSET ms
call GetMessageA

or eax, eax
je @@Exit

push OFFSET ms
call TranslateMessage

push OFFSET ms
call DispatchMessageA

jmp @@Messages

@@Exit:

[/size]

Posted on 2002-02-11 08:58:34 by stryker
cmax,

this is an example directly out of the MASM32 example code.


StartLoop:
push 0
push 0
push NULL
push offset msg
call GetMessage

cmp eax, 0
je ExitLoop

push offset msg
call TranslateMessage

push offset msg
call DispatchMessage

jmp StartLoop
ExitLoop:

Its in example2\tstyle

Regards,

hutch@movsd.com

Funny, it IS really similar to the code umberg6007 posted from TASM source. The senile decay must not be too bad at the moment.
:tongue:
Posted on 2002-02-11 09:08:23 by hutch--
hutch, you..............
Posted on 2002-02-11 09:11:37 by stryker
Do it as per normal in masm, then assemble using /Fl and /Sa.
Masm will expand all its internal macros for you:


invoke MessageBox, NULL, ADDR buffer, NULL, MB_OK
00000014 2 6A 00 * push +000000000h
00000016 2 6A 00 * push +000000000h
00000018 2 68 00000005 R * push OFFSET buffer
0000001D 2 6A 00 * push +000000000h
0000001F 7m E8 00000000 E * call MessageBoxA

All the lines with a star are "hidden from view" internals that masm has messed around with.

Mirno
Posted on 2002-02-11 09:38:00 by Mirno
I just want to get into, and have more control coding wise and understand the message loop. I still want to use invoke...

Can i still do this....

Will using invoke still be possible if i do the push Method with the message parts only...

Posted on 2002-02-11 11:31:43 by cmax
hutch--, great feeling seeing your code all over the place. :alright:
Posted on 2002-02-11 11:49:56 by bitRAKE
Ya, it don't look good.

Too many steps backward.

It's too hard to see what you doing...But I did get a better idea about how things work out of it anyway...So thats a Plus...

Thank everybody for showing me some of the other possibility.
Posted on 2002-02-11 13:28:16 by cmax
Because msg is a LOCAL, you should change

PUSH msg.message

to

LEA eax,msg ; get address of msg
PUSH eax
Posted on 2002-02-11 16:46:03 by tank
Thank tank,

I found it, sorry, all of a sudden, phone ring ofF the hook. everybody don't know wht to do these days...


masm32 Example 1.........LEA was the key

Oldstyle.asm
oldschool


Huuuurtesssss


You guys are the The Greatest...

I think even Hutch forgot about it....MayBE


Now i got to see about RING_asm (0)... in XP
Posted on 2002-02-11 20:11:47 by cmax
Use "invoke" together with "addr", and the code will work whether
msg is local or global.

ring_asm(0)? Sounds like something that will definitely only work
on 9x ;).
Posted on 2002-02-12 09:58:28 by f0dder