-- hides "tutorial" on start-up, restores on exit --

include win32lib.ew

constant
	CYFULL = w32Func( xGetSystemMetrics, {SM_CYSCREEN} ),
	Win = create( Window, "kick-tutorials", 0, 100, 0, 150, CYFULL, {WS_CAPTION, WS_SYSMENU} ),
	-- new function !
	zFindWindow = registerw32Function( user32, "FindWindowA", {C_POINTER,C_INT}, C_INT ) 

atom ptr, ptr2, ok, tutorialhwnd

procedure hide_tutorial( integer self, integer event, sequence params )
  ptr = allocate_string("Win32Lib AppWindow 1")
  ptr2 = allocate_string("Euphoria Win32 Tutorials")
  tutorialhwnd= w32Func( zFindWindow, { ptr, ptr2 } )
  ok = w32Func( xShowWindow, {tutorialhwnd, SW_HIDE } )
  free(ptr)
  free(ptr2)
end procedure

-- you MUST do this on program exit ;-)
procedure restore_tutorials( integer self, integer event, sequence params )
ok = w32Func( xShowWindow, {tutorialhwnd, SW_SHOW } )
ok = w32Func( xSetForegroundWindow,{tutorialhwnd})
end procedure

setHandler( Win, w32HOpen, routine_id("hide_tutorial") )
setHandler( Win, w32HClose, routine_id("restore_taskbar") )

WinMain( Win, Normal )
