i make a window,the code under is process window message,can you tell me what different between that two word i make it in red color.
_ProcWinMain proc uses ebx edi esi,hWnd,uMsg,wParam,lParam
local @stRect:RECT
local @hDc

mov eax,uMsg
.if eax == WM_PAINT
invoke BeginPaint,hWnd,addr @stPs
mov @hDc,eax

invoke GetClientRect,hWnd,addr @stRect
invoke DrawText,@hDc,addr szText,-1,\
addr @stRect,\

invoke EndPaint,hWnd,addr @stPs
.elseif eax == WM_CLOSE
invoke DestroyWindow,hWinMain
invoke PostQuitMessage,NULL
invoke DefWindowProc,hWnd,uMsg,wParam,lParam
xor eax,eax

_ProcWinMain endp
Posted on 2003-08-31 11:00:34 by tomorrow
Hi tomorrow,

hWnd is the handle to the window that is passed as part of the message by Windows. It is local in scope and can be used only in your WindowProc. hWinMain is probably a label you assigned as the global handle of your window at creation for example:

invoke CreateWindowEx,.....
mov hWinMain,eax

In any case your program should settle on using one or the other in your WindowProc and stay consistent with that. I would suggest that you replace hWinMain with hWnd, especially in the WM_CLOSE handler as it will gaurantee that you are dstroying the right window. There could be a situation where for one reason or another hWinMain is overwritten at runtime and the window refuses to close as you are not passing the right handle.
Posted on 2003-08-31 11:34:29 by donkey
thank you
you say ,i replace hWinMain with hWnd,is it?
Posted on 2003-09-02 01:40:25 by tomorrow
Sounds good to me :)
Posted on 2003-09-02 02:17:01 by donkey
i know,do you know ,that code write by a book author,now i study win32asm use his book.
Posted on 2003-09-02 02:25:30 by tomorrow