cw_usedefault, cw_usedefault,\
300,200,null,null, hinst,null
mov hwnd,eax
invoke showwindow, hwnd,sw_shownormal
invoke updatewindow, hwnd
.while true
invoke getmessage, addr msg,null,0,0
.break .if (!eax)
invoke translatemessage, addr msg
invoke dispatchmessage, addr msg
.endw
mov eax,msg.wparam
ret
winmain endp
wndproc proc hwnd:hwnd, umsg:uint, wparam:wparam, lparam:lparam
.if umsg==wm_destroy
invoke postquitmessage,null
.elseif umsg==wm_create
invoke createwindowex,ws_ex_clientedge, addr editclassname,null,\
ws_child or ws_visible or ws_border or es_left or\
es_autohscroll,\
50,35,200,25,hwnd,8,hinstance,null
mov hwndedit,eax
invoke setfocus, hwndedit
invoke createwindowex,null, addr buttonclassname,addr buttontext,\
ws_child or ws_visible or bs_defpushbutton,\
75,70,140,25,hwnd,buttonid,hinstance,null
mov hwndbutton,eax
.elseif umsg==wm_command
mov eax,wparam
.if lparam==0
.if ax==idm_hello
invoke setwindowtext,hwndedit,addr teststring
.elseif ax==idm_clear
invoke setwindowtext,hwndedit,null
.elseif ax==idm_gettext
invoke getwindowtext,hwndedit,addr buffer,512
invoke messagebox,null,addr buffer,addr appname,mb_ok
.else
invoke destroywindow,hwnd
.endif
.else
.if ax==buttonid
shr eax,16
.if ax==bn_clicked
invoke sendmessage,hwnd,wm_command,idm_gettext,0
.endif
.endif
.endif