Author Topic: message loop error  (Read 2481 times)

shankle

  • Member
  • ****
  • Posts: 833
message loop error
« 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

dedndave

  • Member
  • *****
  • Posts: 8823
  • Still using Abacus 2.0
    • DednDave
Re: message loop error
« Reply #1 on: December 05, 2012, 02:53:54 PM »
could it be a UNICODE issue ?
MessageBoxA

japheth

  • Guest
Re: message loop error
« Reply #2 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.

shankle

  • Member
  • ****
  • Posts: 833
Re: message loop error
« Reply #3 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.