Skip to content

Instantly share code, notes, and snippets.

@tuttlem
Created November 22, 2012 13:12
Show Gist options
  • Save tuttlem/4131110 to your computer and use it in GitHub Desktop.
Save tuttlem/4131110 to your computer and use it in GitHub Desktop.
MessageBox Masm Body
; #########################################################################
.code
start:
invoke GetModuleHandle, NULL ; provides the instance handle
mov hInstance, eax
invoke GetCommandLine ; provides the command line address
mov szCommandLine, eax
; actually invoke the windows entry point for the application
invoke WinMain,hInstance,NULL,szCommandLine,SW_SHOWDEFAULT
invoke ExitProcess,eax ; cleanup & return to operating system
; #########################################################################
; The application's entry point (according to windows)
WinMain proc hInst :DWORD,
hPrevInst :DWORD,
CmdLine :DWORD,
CmdShow :DWORD
; declare some variables to use
szText szDialogTitle, "First example"
szText szMessageText, "This is masm32 at work!"
; show the message box
invoke MessageBox, 0, ADDR szDialogTitle, ADDR szMessageText, MB_OK
; exit this function with success (eax == 0)
xor eax, eax
ret
WinMain endp
end start
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment