include win32lib.ew

constant
win1=create( Window, "Minimize all but me...1", 0, 100, 100, 300, 150, 0 ), 

-- constants,  and functions not in win32lib,  yet !
KEYEVENTF_KEYUP = 2, 
MinimizeAll = 77, 
zkeybd_event=registerw32Function(  user32, 
             "keybd_event",  { C_INT,  C_INT,  C_INT,  C_INT },  C_INT  )

----

procedure minimize_all(  integer self,  integer event,  sequence params  )
    atom jk
    showWindow( win1,  True  )
    sleep( 1 )
    showWindow( win1,  False  )
    jk = w32Func( zkeybd_event,  {VK_LWIN,  0,  0,  0 }  )
    jk = w32Func( zkeybd_event,  {MinimizeAll,  0,  0,  0 }  )
    jk = w32Func( zkeybd_event,  {VK_LWIN,  0,  KEYEVENTF_KEYUP,  0 }  )
    sleep( 2 )
    jk = w32Func(  xShowWindow,  {getHandle( win1 ),  SW_RESTORE}  )
end procedure
setHandler(  win1,  w32HOpen,  routine_id( "minimize_all" )  )

----

WinMain(  win1,  Normal  )

--------
