Skip to content

Instantly share code, notes, and snippets.

@tuttlem
Created November 24, 2012 01:40
Show Gist options
  • Save tuttlem/4137996 to your computer and use it in GitHub Desktop.
Save tuttlem/4137996 to your computer and use it in GitHub Desktop.
MessagePump WinMain
WinMain proc hInst :DWORD,
hPrevInst :DWORD,
szCmdLine :DWORD,
nCmdShow :DWORD
LOCAL msg :MSG
MessagePump_Loop:
; take the next message out of the queue to process
invoke GetMessage, ADDR msg, NULL, 0, 0
; check if we just processed a WM_QUIT and get out
; if we did
cmp eax, 0
je MessagePump_Done
; translate and dispatch the message as usual
invoke TranslateMessage, ADDR msg
invoke DispatchMessage, ADDR msg
; keep processing messages
jmp MessagePump_Loop
MessagePump_Done:
xor eax, eax
ret
WinMain endp
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment