Home
Search
 
What's New
Index
Books
Links
Q & A
Newsletter
Banners
 
Feedback
Tip Jar
 
 
 
 
500MB 27GB Web Hosting - $9.95/Month
 
 
 
 
 
Old Pages
 
Old Index
Site Map
What's New
 
Books
How To
Tips & Tricks
Tutorials
Stories
Performance
Essays
Links
Q & A
New in VB6
Free Stuff
Pictures
 
 
 
TitleFind a window using its title and minimize, maximize, or restore it
Keywordsfind window, findwindow, API, minimize, maximize, restore, SetWindowPlacement
CategoriesAPI
 
Use the FindWindow API function to find the window's handle. Then use the SetWindowPlacement API function to minimize, maximize, or restore it.
 
' Find the target window and minimize, maximize,
' or restore it.
Private Sub cmdGo_Click()
Dim app_hwnd As Long
Dim wp As WINDOWPLACEMENT

    ' Find the target.
    app_hwnd = FindWindow(vbNullString, txtTargetName.Text)

    ' Get the window's current placement information.
    wp.length = Len(wp)
    GetWindowPlacement app_hwnd, wp

    ' Set the appropriate action.
    If optPlacement(0).Value Then
        ' Minimize.
        wp.showCmd = SW_SHOWMINIMIZED
    ElseIf optPlacement(1).Value Then
        ' Maximize.
        wp.showCmd = SW_SHOWMAXIMIZED
    Else
        ' Restore.
        wp.showCmd = SW_SHOWNORMAL
    End If

    ' Perform the action.
    SetWindowPlacement app_hwnd, wp
End Sub
 
 
Copyright © 1997-2003 Rocky Mountain Computer Consulting, Inc.   All rights reserved.
  Updated