Win32


3. - 6


ENDIF

 

msg_loop:

call GetMessageA, offset msg, 0, 0, 0

or ax,ax

jz exit

call TranslateMessage, offset msg

call DispatchMessageA, offset msg

jmp msg_loop

exit: call ExitProcess, 0

 

public stdcall WndProc

proc WndProc stdcall

arg @@hwnd: dword, @@msg: dword, @@wPar: dword, @@lPar: dword

mov eax,[@@msg]

cmp eax,WM_COMMAND

je @@command

cmp eax,WM_DESTROY

jne @@default

call PostQuitMessage, 0

xor eax,eax

jmp @@ret

@@default:

call DefWindowProcA, [@@hwnd], [@@msg], [@@wPar], [@@lPar]

@@ret: ret

@@command:

mov eax,[@@wPar]

cmp eax,ID_OPEN

je @@open

cmp eax,ID_SAVE

je @@save

call SendMessageA, [@@hwnd], WM_CLOSE, 0, 0

xor eax,eax

jmp @@ret

@@open: mov eax, offset msg_open_txt

mov edx, offset msg_open_tlt

jmp @@mess

@@save: mov eax, offset msg_save_txt

mov edx, offset msg_save_tlt

@@mess: call MessageBoxA, 0, eax, edx, MB_OK

xor eax,eax

jmp @@ret

endp WndProc

end Start