Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations biv343 on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

maximize active window

Status
Not open for further replies.

sparkbyte

Technical User
Sep 20, 2002
879
US
Anyone know how to find or set the current active window and maximize it?

Thanks

John Fuhrman
Titan Global Services
 
The only thing I've been able to find to get the active window is this:

I know "Word.Application" can maximize a window, but of course you would need to know which window is active and its title to do so.

--------------------------------------------------------------------------------
dm4ever
My philosophy: K.I.S.S - Keep It Simple Stupid
 
The site mentioned by dm4ever includes JSSys3.dll, which can be used to do a multitude of things, including:
GetOpenWindowTitles
GetActiveWindowTitle
SetWindowActive

For example:

Code:
Dim sys 
Set sys = CreateObject("JSSys3.Ops")

v = Sys.GetOpenWindowTitles(a)
If v > 0 Then
   For i = 0 To UBound(a)
      If InStr(1, a(i), "textpad", vbTextCompare) <> 0 Then
        s = a(i)
        Exit For
      End If
   Next

   If s <> "" Then
      Set WshShell = CreateObject("WScript.Shell")

      WshShell.AppActivate s
      WScript.Sleep 1000 
      WshShell.SendKeys ("% x")
   End If
End if
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top