-- don't stay minimized in the taskbar
-- for *more* than 5 seconds.
include win32lib.ew
without warning

atom jk, count
count=0

constant
MyWin=create(Window,"Minimize Me !",0,10,10,200,100,0),
MyData=create(LText,"",MyWin,5,5,180,20,0),
MyTimer=1

setTimer(MyWin,1,5000)

procedure on_Timer( integer timerId )
if w32Func(xIsIconic,{getHandle(MyWin)}) then
  jk=w32Func(xShowWindow,{getHandle(MyWin),SW_RESTORE})
  count+=1
  setText(MyData,sprintf("I've been minimized %d times.",count))
end if
end procedure
--

onTimer[MyWin]=routine_id("on_Timer")

WinMain(MyWin,Normal)
