format PE GUI 4.0
entry start
include 'win32a.inc'
section '.data' data readable writeable
ParentClass db 'Window',0
ParentTitle db 'Окно',0
ParentError db 'Ошибка',0
ParentColor = 3
WinClass WNDCLASS 0, WindowProc, 0, 0,0,0, 0, ParentColor, 0,ParentClass
msg MSG
section '.code' code readable executable
start:
invoke GetModuleHandle,0
mov [WinClass.hInstance],eax
invoke LoadIcon,0,IDI_APPLICATION
mov [WinClass.hIcon],eax
invoke LoadCursor,0,IDC_ARROW
mov [WinClass.hCursor],eax
invoke RegisterClass,WinClass
cmp eax,0
je error
invoke CreateWindowEx,0, ParentClass, ParentTitle, \
WS_VISIBLE+WS_THICKFRAME+WS_SYSMENU, \
128, 128, 256, 192, 0, 0, [WinClass.hInstance],0
cmp eax,0
je error
msg_loop:
invoke GetMessage,msg,0,0,0
cmp eax,0
je exit
invoke TranslateMessage,msg
invoke DispatchMessage,msg
jmp msg_loop
error:
invoke MessageBox,HWND_DESKTOP,ParentError,0,MB_OK
exit:
invoke ExitProcess,[msg.wParam]
proc WindowProc hwnd,wmsg,wparam,lparam
push ebx esi edi
cmp [wmsg],WM_DESTROY
je destroy
.defwndproc:
invoke DefWindowProc,[hwnd],[wmsg],[wparam],[lparam]
jmp exit_proc
destroy:
invoke PostQuitMessage,0
mov eax,0
exit_proc:
pop edi esi ebx
ret
endp
section '.idata' import data readable writeable
library kernel32,'KERNEL32.DLL',\
user32,'USER32.DLL'
include 'api\kernel32.inc'
include 'api\user32.inc'