My FAsm translation of Tut 3 (Painting Text) loads, executes through all of the calls, and hits and loops in the message loop. But it doesn't create and windows. I had 3 instances running for 2 hours before I realized that the program wasn't exiting. The source is avaliable at: Tut 3: Paint Text Great apreciation to anyone who can help. This message was edited by eet_1024, on 6/27/2001 1:26:08 AM
Posted on 2001-06-27 01:25:00 by eet_1024
eet I think your problem is here,

;***-------------------------------------------------***
WndProc:
    pop     
    pop     
    pop     
    pop     

    cmp     eax, WM_DESTROY    ;<<<<<<<<<<<<<<
    ; ===========================================
    ; should be cmp , WM_DESTROY
    ; CMP Memory, immediate
    ; ===========================================
    ; same with other processed messages, it MUST be the message
    ; passed to the WndProc procedure.
    ; ===========================================

    jnz     Else_If

    push    0
    call    
    jmp     End_If
Regards, hutch@pbq.com.au
Posted on 2001-06-27 01:34:00 by hutch--
I don't know were I got the eax from. Thanks for pointing that out. The program (After fixing the 2 eax's) still hangs (or inf loops) in mem with out creating any windows.
Posted on 2001-06-27 01:48:00 by eet_1024
eet, the next problem is here, the WndProc is not processing the default window processing when it should.

Else:
    push    
    push    
    push    
    push    
    call    
    ret
The DefWindowProc should be processed with every message that is sent to the WndProc unless the message is supposed to return ZERO. Change the end of the WndProc so all messages are default processed unless you specify otherwise. Regards, hutch@pbq.com.au PS: I tried to build it but I don't have the file \Asm_Win32\Include\Win32_Equ.inc This message was edited by hutch--, on 6/27/2001 2:04:51 AM
Posted on 2001-06-27 01:58:00 by hutch--
Sorry about the include file. I added it to the zip (which contains the eax fixes also). So I should call DefWindowProc everytime, and not clear eax?
Posted on 2001-06-27 02:10:00 by eet_1024
eet, I have just been playing with the win32app.asm file that comes with FASM and it uses a TASM style message cracker which works OK when you don't have MASM style .IF syntax for a message handling proc. The example puts the call to DefWindowProc() directly after the message cracker but before the labels where each message jumps to. Each message is specific and you should check each one to see what it requires as a return value but by default each message should be handled by the default processing for the window. I have the example up and running and while I have been at FASM for about an hour all up, it seems to work OK even though I don't fully understand all of the syntax and directives. What I would suggest is that you create a basic template from it or similar and get your preferred architecture going properly, then start doing a range of example code so that other people can see how FASM works. Regards, hutch@pbq.com.au
Posted on 2001-06-27 03:26:00 by hutch--
eet__1024, I dont understand this FASM stuff, but I wonder how you can call a subroutine and in that subroutine do "pop" the parameters, without first saving the return address, which should be first dword on the stack? Does this FASM automatically for you? ok. now i have executed your exe under control of VC 50. this shows almost at once that FASM does NOTHING for you. So if you want to "pop" the parameters from a function call, save the return address first. example:

    push parm2
    push parm1
    call proc
    ....
proc:
    pop eax
    pop parm1
    pop parm2
    push eax
    ...
    ret

this should work

japheth

This message was edited by japheth, on 6/27/2001 3:39:42 AM
Posted on 2001-06-27 03:32:00 by japheth
Thanks Japheth for pointing that out. I completely forgot about that. Hutch, the original source code also had the DefProc in the else structure. And would clear the eax before returning. I just looked it up, it's Tuturiol 4 of of Iczelion's site. This message was edited by eet_1024, on 6/27/2001 1:03:22 PM
Posted on 2001-06-27 13:02:00 by eet_1024
Thanx Hutch and Japheth. I implemented both of your corrections (except for the DefProc) and now The program works. Well almost. It doesn't display the text. Is this related to the DefProc. Can you please clarify on how I should be using the DefProc? Thanks
Posted on 2001-06-27 22:13:00 by eet_1024
You can find some new (and better) examples of fasm Win32 programming in a new release of fasm - please look at the http://omega.im.uj.edu.pl/~grysztar/fasm/fasm112.zip
Posted on 2001-06-30 08:35:00 by Tomasz Grysztar