My question concerns responding to the Windows WM_DESTROY
message using NASM.
In Microsoft Macro Assembler the following code is used in
response to the WM_DESTROY message :
.if uMsg == WM_DESTROY
invoke PostQuitMessage, NULL
xor eax,eax
ret
.endif
When I port that exact code to Netwide Assembler the program
crashes on exit :
if dword argv(umsg), ==, WM_DESTROY
invoke PostQuitMessage, NULL
xor eax,eax
ret
endif
My solution has been to eliminate the RET and allow the
pointer to fall through to DefWndProc. Amazingly, this
works with no apparent problem and the program exits
gracefully and seems stable.
if dword argv(umsg), ==, WM_DESTROY
invoke PostQuitMessage, NULL
xor eax,eax
; ret <---------- RET eliminated
endif
. . . more code
DefWndProc etc. <---- falls through to here
;------------------------------------------------------
As a test, I trapped the ESC key using VK_ESCAPE and
inserted the original code. It worked with no problems.
It seems to be only in response to WM_DESTROY that
the problem occurs.
I scanned the NASM bug reports for WM_DESTROY and
PostQuitMessage but there were no hits.
Thanks in advance.