The MASM Forum

Projects => Rarely Used Projects => GoAsm => Topic started by: shankle on December 05, 2012, 02:27:01 PM

Title: message loop error
Post by: shankle on December 05, 2012, 02:27:01 PM
In my 1st 64-bit program the following code works just fine.
In my 2nd 64-bit program the following code works just fine.
In my 3rd 64-bit program it produces an error at L2.
Same code in all three programs.
What have I done wrong?????

WinMain:
    FRAME hInst,hPrevInst,CmdLine,CmdShow
   LOCAL wc:WNDCLASSEXA,msg:MSG,hWnd,RR:RECT     

L1:
    INVOKE GetMessageA,addr msg,0,0,0
    test eax,eax              ;see if it is WM_QUIT
    jz >L3                    ;yes
    cmp eax,-1
    je >L2
    INVOKE TranslateMessage,addr msg
    INVOKE DispatchMessageA,addr msg
    jmp L1              ;after message is dealt with, loop back for next one
L2:   
;msg4             db   'in message loop',0
;msg5             db   'error in return value',0
        invoke MessageBox, [hWnd], addr msg4, addr msg5, MB_OK ;true
L3:                     ;message was WM_QUIT
    ret
ENDF
Title: Re: message loop error
Post by: dedndave on December 05, 2012, 02:53:54 PM
could it be a UNICODE issue ?
MessageBoxA
Title: Re: message loop error
Post by: japheth on December 05, 2012, 08:00:51 PM
What MSDN has to say about GetMessage:

Quote
If there is an error, the return value is -1. For example, the function fails if hWnd is an invalid window handle or lpMsg is an invalid pointer. To get extended error information, call GetLastError.

You have no hWnd, but lpMsg can be checked for plausibility. If this gives you no idea, use GetLastError.
Title: Re: message loop error
Post by: shankle on December 06, 2012, 02:32:11 AM
Thanks for your suggestions.
The problem is now solved.
It was caused by the Crimsom Editor and me.
It was putting things in places I did not intend them to go to.