A crude, and I think near minimal, MASM32 example that uses a message-only window with a timer:
;==============================================================================
include \masm32\include\masm32rt.inc
;==============================================================================
.data?
msg MSG <>
wcx WNDCLASSEX <>
.data
counter dd 0
className db "timer_class",0
.code
;==============================================================================
TimerProc proc hwnd:DWORD,uMsg:DWORD,idEvent:DWORD,dwTime:DWORD
inc counter
.IF counter > 5
invoke KillTimer, NULL, 1
exit
.ENDIF
MsgBox hwnd,0,"Timer",0
ret
TimerProc endp
;==============================================================================
start:
;==============================================================================
mov wcx.cbSize, SIZEOF WNDCLASSEX
invoke GetModuleHandle, NULL
push eax
pop wcx.hInstance
mov wcx.lpszClassName, OFFSET className
invoke RegisterClassEx, ADDR wcx
invoke SetTimer,NULL,1,1000,TimerProc
invoke CreateWindowEx, 0,0,0,0,0,0,0,0,HWND_MESSAGE,0,0,0
msgLoop:
invoke GetMessage, ADDR msg, NULL, 0, 0
.IF eax > 0
invoke DispatchMessage, ADDR msg
jmp msgLoop
.ENDIF
exit msg.wParam
end start