Element MainForm BaseElements include 'Win.inc' EndBase GlobalConst PCharConst main_class,'Form' GlobalInit push main_class push 0 push COLOR_BTNFACE+1 invoke LoadCursor,0,IDC_ARROW push eax push 0 push [hinstance] push 0 push 0 push Window.WindowProc push CS_DBLCLKS invoke RegisterClass,esp add esp,40 Vars Self#.hfocused dd ? Create wes = 0 ws = WS_CLIPCHILDREN if Self#.prop.BorderStyle = 1 ws = ws+WS_CAPTION+WS_SYSMENU+WS_MINIMIZEBOX else if Self#.prop.BorderStyle = 2 ws = ws+WS_CAPTION+WS_SYSMENU+WS_MAXIMIZEBOX+WS_MINIMIZEBOX+WS_THICKFRAME else if Self#.prop.BorderStyle = 3 ws = ws+WS_CAPTION+WS_SYSMENU else if Self#.prop.BorderStyle = 4 ws = ws+WS_CAPTION+WS_SYSMENU wes = wes+WS_EX_TOOLWINDOW else if Self#.prop.BorderStyle = 5 ws = ws+WS_CAPTION+WS_SYSMENU+WS_THICKFRAME wes = wes+WS_EX_TOOLWINDOW else if Self#.prop.BorderStyle = 6 ws = ws+WS_POPUP wes = wes+WS_EX_DLGMODALFRAME else if Self#.prop.BorderStyle = 7 ws = ws+WS_POPUP+WS_THICKFRAME else ws = ws+WS_POPUP end if mov [Self#.Border],0 NewWindow Self,Parent,main_class,Self#.prop.Caption,ws,wes if Self#.prop.BorderStyle > 0 invoke LoadIcon,[hinstance],Self#.prop.Icon invoke SendMessage,[Self#.hwnd],WM_SETICON,ICON_SMALL,eax end if PostInit stdcall AlignChildWindows,[Self#.hwnd] stdcall FindNextTab,[Self#.hwnd],0,0 or eax,eax jne @f mov eax,[Self#.hwnd] @@:mov [Self#.hfocused],eax invoke SetFocus,eax Self#.onCreate 0,data_null MessageMap if Parent eq 0 cmp [wmsg],WM_DESTROY jne @f invoke PostQuitMessage,0 else cmp [wmsg],WM_CLOSE jne @f invoke ShowWindow,[hwnd],SW_HIDE end if jmp Self#.finish @@:cmp [wmsg],WM_ACTIVATE jne .noactivate cmp word [wparam],WA_INACTIVE je @f invoke SetFocus,[pMainForm.hfocused] jmp Self#.finish @@:invoke GetFocus mov [pMainForm.hfocused],eax jmp Self#.finish .noactivate: Destroy if ~ Parent eq 0 invoke DestroyWindow,[Self#.hwnd] invoke DeleteObject,[Self#.hfont] end if PointWork doClose invoke SendMessage,[Self#.hwnd],WM_CLOSE,0,0 EndPoint EndElement