PROWAREtech

articles » current » assembly » x86 » hello-windows

x86 Assembly: Hello Windows Example

Example Windows Program.

This simple example keeps looping until the user cancels it. Download the assembly source code: ASMHELLOWIN.zip

TITLE Hello Windows

.386P
.model flat,stdcall
.stack 8192
ExitProcess PROTO, dwExitCode:DWORD
MessageBoxA PROTO, hwnd:DWORD, lpText:PTR BYTE, lpCaption:PTR BYTE, uiStyle:DWORD

.data
hello BYTE "Hello Windows!",0

.code
WinMain PROC

msgbox:
	mov   ebx, 40h          ; 64 is the information icon
	or    ebx, 1h           ; 1 is the OK/Cancel buttons
	pushd ebx               ; uiStyle
	mov   ebx, offset hello
	pushd ebx               ; lpCaption
	pushd ebx               ; lpText
	pushd 0                 ; hwnd
	call  MessageBoxA
	cmp   eax, 1h           ; 1 is the OK button being pressed; compare eax to 1
	je    msgbox            ; if eax equals 1, jump to msgbox:

	pushd 0
	call	ExitProcess

WinMain ENDP
END WinMain

PROWAREtech

Hello there! How can I help you today?
Ask any question

PROWAREtech

This site uses cookies. Cookies are simple text files stored on the user's computer. They are used for adding features and security to this site. Read the privacy policy.
CLOSE