format PE GUI 4.0 entry WinMain include 'win32a.inc' include 'api\kernel32.inc' include 'api\user32.inc' include 'api\gdi32.inc' macro JumpIf value, lable { cmp eax, value je lable } data import library kernel32, 'kernel32.dll',\ user32, 'user32.dll',\ gdi32, 'gdi32.dll' end data ClassName db 'MainWindow', 0 wndClass WNDCLASS 0, WinProc, 0, 0, 0, 0, 0, 0, 0, ClassName WINDOW_STYLE = WS_VISIBLE + WS_SYSMENU proc WinMain locals hMainWindow dd ? msg MSG endl xor ebx, ebx invoke LoadCursor, 0, IDC_ARROW mov [wndClass.hCursor], eax invoke RegisterClass, wndClass ;Create Window invoke CreateWindowEx, ebx, ClassName, ClassName, WINDOW_STYLE,\ ebx, ebx, ebx, ebx, ebx, ebx, ebx, ebx invoke SetTimer, eax, 12345, 1000, NULL test eax, eax lea esi, [msg] MSGLoop: invoke GetMessage, esi, ebx, ebx, ebx test eax, eax jz .EndLoop invoke TranslateMessage, esi invoke DispatchMessage, esi jmp MSGLoop .EndLoop: invoke ExitProcess, [msg.wParam] endp proc WinProc uses ebx esi edi,\ hWnd, wMsg, wParam, lParam mov eax, [wMsg] JumpIf WM_PAINT, .Paint JumpIf WM_TIMER, .Timer JumpIf WM_DESTROY, .Destroy .Default: invoke DefWindowProc, [hWnd], [wMsg], [wParam], [lParam] jmp .EndProc .Timer: invoke ExitProcess, 0 .Paint: ;jmp .Default ;1) jpm Default WM_TIMER work jmp .ReturnZero ;2) jmp ReturnZero WM_TIMER doesn't work .Destroy: invoke ExitProcess, ebx .ReturnZero: xor eax, eax .EndProc: ret endp