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
###################################
.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
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]
cmax,
this is an example directly out of the MASM32 example code.
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:
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:
hutch, you..............
Do it as per normal in masm, then assemble using /Fl and /Sa.
Masm will expand all its internal macros for you:
All the lines with a star are "hidden from view" internals that masm has messed around with.
Mirno
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
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
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:
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.
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.
Because msg is a LOCAL, you should change
PUSH msg.message
to
LEA eax,msg ; get address of msg
PUSH eax
PUSH msg.message
to
LEA eax,msg ; get address of msg
PUSH eax
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
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
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 ;).
msg is local or global.
ring_asm(0)? Sounds like something that will definitely only work
on 9x ;).