News:

MASM32 SDK Description, downloads and other helpful links
MASM32.com New Forum Link
masmforum WebSite

difficults with win.asm

Started by ix00, December 25, 2007, 07:43:27 PM

Previous topic - Next topic

ix00

 :eek
why it is bit of code the unviewing
i do not see this bit of code in turbodebugger32 (borland)
...
...
WndProc proc hWnd:HWND,uMsg:UINT,wParam:WPARAM,lParam:LPARAM
.IF uMsg==WM_DESTROY
invoke PostQuitMessage,NULL
.ELSE
invoke DefWindowProc,hWnd,uMsg,wParam,lParam      
ret
.ENDIF
xor eax,eax
ret
WndProc endp
...
...
it may be like this?

start.
maincode
invoke DefWindowProc,hWnd,uMsg,wParam,lParam
exitcode
end.

hutch--

The logic in this piece of code is very untidy. Normally when you process a WM_DESTROY message you simply call PostQuitMessage(). If you need to optionally do something else like save any files first you perform the check in the WM_CLOSE message handling which you can either allow or disallow depending on the choice.

You should call the DefWindowProc() function only at the end of the WndProc procedure as it is the default processing for messages you don't want to process yourself. The exception is a mesage that requires that you return zero where you set EAX to zero and then call RET.
Download site for MASM32      New MASM Forum
https://masm32.com          https://masm32.com/board/index.php