WNDSIZE = Array("1024x768", "800x600", "640x480") 'list of dimensions to which the window should get resized

Set wnd = CreateObject("UltraMon.Window")
If wnd.GetForegroundWindow() = True Then
	cx = wnd.Width
	cy = wnd.Height

	iNextSize = 0
	For i = 0 To UBound(WNDSIZE)
		sz = Split(WNDSIZE(i), "x")
		If CLng(sz(0)) = cx And CLng(sz(1)) = cy Then
			iNextSize = i + 1
			If iNextSize > UBound(WNDSIZE) Then iNextSize = 0
			Exit For
		End If
	Next

	Set sys = CreateObject("UltraMon.System")
	Set mon = sys.Monitors(wnd.Monitor - 1)
	wnd.Left = mon.WorkLeft
	wnd.Top = mon.WorkTop
	wnd.ShowState = 2 'SHOWSTATE_NORMAL

	sz = Split(WNDSIZE(iNextSize), "x")
	wnd.Width = CLng(sz(0))
	wnd.Height = CLng(sz(1))
	wnd.ApplyChanges 0
End If
