-- screensize1.exw by Ad Rienks.
-- Demo using GetSystemMetrics to read screenwidth and screenheight
-- (I like a Windows program to fill (most of) my screen!)

include getsysms.ew --** a simple custom 'include' file.
include Win32lib.ew --
without warning

integer xScreen, yScreen

-- these are calls to an API function, declared in the GetSysMs.ew include.
xScreen = GetSystemMetrics(SM_CXSCREEN)
yScreen = GetSystemMetrics(SM_CYSCREEN)

constant Main = create(Window, "Adjusting screen", 0, 0, 0,
                 xScreen,            -- calculated screenwidth,
                 yScreen - 30,       -- and screenheight - 30
                 0)                  -- to keep taskbar visible.

procedure onPaint_Main(atom self, atom event, sequence params)	--(integer x1,integer y1,integer x2,integer y2)
-- behaviour when the main window paints/repaints itself.
    setPenPos(Main, 0, 0)
    wPuts(Main, "ScreenWidth  = " & sprintf("%d ", xScreen))
    setPenPos(Main, 0, 20)
    wPuts(Main, "ScreenHeight = " & sprintf("%d ", yScreen))
end procedure

-- linking the onPaint 'event' for the main window and the procedure
-- to call. (the 'method' in OOP lingo)
setHandler( Main, w32HPaint,  routine_id("onPaint_Main") )

WinMain(Main,Normal)

-- end of screensize1.exw
