local hwnd:hwnd
mov wc.cbsize,sizeof wndclassex ; fill values in members of wc
mov wc.style, cs_hredraw or cs_vredraw
mov wc.lpfnwndproc, offset wndproc
mov wc.cbclsextra,null
mov wc.cbwndextra,null
push hinstance
pop wc.hinstance
mov wc.hbrbackground,color_window+1
mov wc.lpszmenuname,null
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 ; register our window class
invoke createwindowex,null,\
addr classname,\
addr appname,\
ws_overlappedwindow,\
cw_usedefault,\
cw_usedefault,\
cw_usedefault,\
cw_usedefault,\
null,\
null,\
hinst,\
null
mov hwnd,eax
invoke showwindow, hwnd,cmdshow ; display our window on desktop
invoke updatewindow, hwnd ; refresh the client area
.while true ; enter message loop
invoke getmessage, addr msg,null,0,0
.break .if (!eax)
invoke translatemessage, addr msg
invoke dispatchmessage, addr msg
.endw
mov eax,msg.wparam ; return exit code in eax
ret
winmain endp
wndproc proc hwnd:hwnd, umsg:uint, wparam:wparam, lparam:lparam
.if umsg==wm_destroy ; if the user closes our window
invoke postquitmessage,null ; quit our application
.else