b> call ShowWindow
push [newhwnd]
call UpdateWindow
push [newhwnd]
call DrawMenuBar
msg_loop:
push L 0
push L 0
push L 0
push offset msg
call GetMessageA
cmp ax, 0
je end_loop
push offset msg
call TranslateMessage
push offset msg
call DispatchMessageA
jmp msg_loop
end_loop:
push [msg.msWPARAM]
call ExitProcess
; ---- Віконна процедура ----
WndProc proc uses ebx edi esi, hwnd: DWORD, wmsg: DWORD,
wparam: DWORD, lparam: DWORD
LOCAL hDC: DWORD
cmp [wmsg], WM_DESTROY
je wmdestroy
cmp [wmsg], WM_SIZE
je wmsize
cmp [wmsg], WM_CREATE
je wmcreate
cmp [wmsg], WM_PAINT
je wmpaint
; **************************************
cmp [wmsg], WM_COMMAND
je wmcommand
; **************************************
jmp defwndproc
wmcommand:
mov eax, lparam
cmp ax, 0
jne m1
mov eax, wparam
cmp ax, IDM_ABOUT
jne m2
call MessageBoxA, 0, offset szHello, offset szAppName, MB_OK
jmp m1
m2: cmp ax, IDM_QUIT
jne m1
push 0
call PostQuitMessage
m1: mov eax, 0
jmp finish
wmcreate:
mov eax, 0
jmp finish
defwndproc:
push [lparam]
push [wparam]
push [wmsg]
push [hwnd]
call DefWindowProcA
jmp finish
wmdestroy:
push L 0
call PostQuitMessage
mov eax, 0
jmp finish
wmsize:
mov eax, 0
jmp finish
wmpaint:
push offset lppaint
push [hwnd]
call BeginPaint
mov [hDC], eax
push offset lppaint
push [hwnd]
call EndPaint
mov eax, 0
jmp finish
finish:
ret
WndProc endp
; ---------------------------------
public WndProc
end start; кінець програми