--screen.exw--
include win32lib.ew
without warning

constant
	CXFULL=w32Func( xGetSystemMetrics, {SM_CXSCREEN} ), 
	CYFULL=w32Func( xGetSystemMetrics, {SM_CYSCREEN} ),
	Win1 = create( Window, "", 0, 0, 0, CXFULL, CYFULL, {WS_POPUP, WS_DLGFRAME} ),
	Win2 = create( Window, "", Win1, 0, 0, 330, 148, {WS_POPUP, WS_DLGFRAME} ),
	Title5  = create( CText, "_empowered by WIN32LIB_", Win2, 1, 121, 322, 20, 0 ),
	Bitmap2 = create( Bitmap, "", Win2, 0, 0, 324, 120, 0 ),

Mytimer1 = 1,
CX=CXFULL-330,
CY=CYFULL-148


setBitmap( Bitmap2, ".\\Bin\\eu.bmp" )
setFont( Title5, "Arial", 12, 3 )

setWindowBackColor( Win1, rgb(0,0,0) )
atom rgbColor  rgbColor = getSysColor(COLOR_BTNFACE)

setWindowBackColor(Win2,rgbColor)

atom posx,posy,xsize,ysize,xdir,ydir
xdir=1 ydir=1

procedure center_win(atom win_id)
	sequence loc  loc=getRect(win_id)
	
	xsize=loc[3]-loc[1]
	ysize=loc[4]-loc[2]
	posx=floor((w32Func(xGetSystemMetrics,{SM_CXFULLSCREEN})/2)-(xsize/2))
	posy=floor((w32Func(xGetSystemMetrics,{SM_CYFULLSCREEN})/2)-(ysize/2))
	setRect(win_id,posx,posy,xsize,ysize,1 )
	
end procedure

procedure start_up( integer self, integer event, sequence params )
	
	center_win(Win2)
	openWindow(Win2,Modal)
	setTimer( Win1, Mytimer1, 25 )
	
end procedure

procedure next_pos( integer self, integer event, sequence params )
	if posx < 1 or posx > CX then 
    	xdir = -xdir
    end if
	
	if posy < 1 or posy > CY then 
    	ydir = -ydir 
	end if
	posx = posx + xdir
	posy = posy - ydir
	setRect(Win2,posx,posy,xsize,ysize,1 )
	
end procedure

procedure exit_prog( integer self, integer event, sequence params )
	closeWindow(Win2)
	closeWindow(Win1)
end procedure

procedure blah( integer self, integer event, sequence params )
	exit_prog( self, event, params )
end procedure

setHandler( Win1, w32HOpen, routine_id("start_up") )
setHandler( Win1, w32HTimer, routine_id("next_pos") )
setHandler( Win2, w32HKeyDown, routine_id("blah") )
setHandler( Win2, w32HClick, routine_id("exit_prog") )

WinMain( Win1,Maximize )
--end--
