teststring db "wow! i'm in an edit box now",0
.data?
hinstance hinstance ?
commandline lpstr ?
buffer db 512 dup(?)
.const
idc_edit equ 3000
idc_button equ 3001
idc_exit equ 3002
idm_gettext equ 32000
idm_clear equ 32001
idm_exit equ 32002
.code
start:
invoke getmodulehandle, null
mov hinstance,eax
invoke getcommandline
mov commandline,eax
invoke winmain, hinstance,null,commandline, sw_showdefault
invoke exitprocess,eax
winmain proc hinst:hinstance,hprevinst:hinstance,cmdline:lpstr,cmdshow:dword
local wc:wndclassex
local msg:msg
local hdlg:hwnd
mov wc.cbsize,sizeof wndclassex
mov wc.style, cs_hredraw or cs_vredraw
mov wc.lpfnwndproc, offset wndproc
mov wc.cbclsextra,null
mov wc.cbwndextra,dlgwindowextra
push hinst
pop wc.hinstance
mov wc.hbrbackground,color_btnface+1
mov wc.lpszmenuname,offset menuname
mov wc.lpszclassname,offset classname
invoke loadicon,null,idi_application
mov wc.hicon,eax
mov wc.hiconsm,eax
invoke loadcursor,null,idc_arrow
mov wc.hcursor,eax
invoke registerclassex, addr wc
invoke createdialogparam,hinstance,addr dlgname,null,null,null
mov hdlg,eax
invoke showwindow, hdlg,sw_shownormal
invoke updatewindow, hdlg
invoke getdlgitem,hdlg,idc_edit
invoke setfocus,eax
.while true
invoke getmessage, addr msg,null,0,0
.break .if (!eax)
invoke isdialogmessage, hdlg, addr msg
.if eax ==false
invoke translatemessage, addr msg
invoke dispatchmessage, addr msg
.endif
.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_command
mov eax,wparam
.if lparam==0
.if ax==idm_gettext
invoke getdlgitemtext,hwnd,idc_edit,addr buffer,512
invoke messagebox,null,addr buffer,addr appname,mb_ok
.elseif ax==idm_clear
invoke setdlgitemtext,hwnd,idc_edit,null
.else
invoke destroywindow,hwnd
.endif
.else