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
could it be a UNICODE issue ?
MessageBoxA
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.
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.