.386
.model flat,stdcall
option casemap:none
include \masm32\include\windows.inc
include \masm32\include\user32.inc
include \masm32\include\kernel32.inc
include \masm32\include\gdi32.inc
include \masm32\include\comdlg32.inc
include \masm32\include\shell32.inc
includelib \masm32\lib\user32.lib
includelib \masm32\lib\kernel32.lib
includelib \masm32\lib\gdi32.lib
includelib \masm32\lib\comdlg32.lib
includelib \masm32\lib\shell32.lib
WinMain proto :DWORD,:DWORD,:DWORD,:DWORD
RGB macro red,green,blue
xor    eax,eax
mov    ah,blue
shl    eax,8
mov    ah,green
mov    al,red
endm
szText MACRO Name,Text:VARARG
LOCAL lbl
jmp    lbl
Name db Text,0
lbl:
ENDM
.const
.data?
hInstance    HINSTANCE ?
CommandLine    LPSTR ?
.data
;_______________
ClassName    db "mbuilder",0
BtnClName    db "button",0
StatClName    db "static",0
EditClName    db "edit",0
LboxClName    db "listbox",0
CboxClName    db "combobox",0
ReditClName    db "richedit",0
RichEditLib    db "riched32.dll",0
FormCaption    db "Form",0
;_______________
.code
start:
invoke GetModuleHandle,NULL
mov    hInstance,eax
invoke GetCommandLine
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 hwnd :HWND
mov    wc.cbSize,SIZEOF WNDCLASSEX
mov    wc.style,CS_BYTEALIGNCLIENT
mov    wc.lpfnWndProc,offset WndProc
mov    wc.cbClsExtra,NULL
mov    wc.cbWndExtra,NULL
push hInst
pop    wc.hInstance
mov    wc.hbrBackground,COLOR_BTNFACE+1
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 CreateWindowEx,0,ADDR ClassName,ADDR FormCaption,WS_SYSMENU or WS_SIZEBOX,400,80,300,200,0,0,hInst,0
mov    hwnd,eax
INVOKE ShowWindow,hwnd,SW_SHOWNORMAL
INVOKE UpdateWindow,hwnd
.WHILE TRUE
    invoke GetMessage,ADDR msg,0,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
.ELSE
    invoke DefWindowProc,hWnd,uMsg,wParam,lParam
    ret
.ENDIF
xor    eax,eax
ret
WndProc endp
end start