Results 1 to 2 of 2

Thread: Getting info about programs, by just knowing it's Caption ???? How ??

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Jul 1999
    Posts
    87

    Post

    How can I check if a Program is minimized, by just knowing the Caption of it ?

  2. #2
    Serge's Avatar
    Join Date
    Feb 1999
    Location
    Scottsdale, Arizona, USA
    Posts
    2,744

    Post

    Sure thing.

    Code:
    Private Type POINTAPI
            x As Long
            y As Long
    End Type
    Private Type RECT
            Left As Long
            Top As Long
            Right As Long
            Bottom As Long
    End Type
    Private Type WINDOWPLACEMENT
            Length As Long
            flags As Long
            showCmd As Long
            ptMinPosition As POINTAPI
            ptMaxPosition As POINTAPI
            rcNormalPosition As RECT
    End Type
    Private Declare Function GetWindowPlacement Lib "user32" (ByVal hwnd As Long, lpwndpl As WINDOWPLACEMENT) As Long
    Private Declare Function FindWindowEx Lib "user32" Alias "FindWindowExA" (ByVal hWnd1 As Long, ByVal hWnd2 As Long, ByVal lpsz1 As String, ByVal lpsz2 As String) As Long
    Private Const SW_SHOWMAXIMIZED = 3
    Private Const SW_SHOWMINIMIZED = 2
    Private Const SW_SHOWNORMAL = 1
    
    
    Private Sub Command1_Click()
        Dim lHwnd As Long
        Dim WinPlace As WINDOWPLACEMENT
        
        lHwnd = FindWindowEx(0, 0, vbNullString, "CaptionNameGoesHere")
        Call GetWindowPlacement(lHwnd, WinPlace)
        Select Case WinPlace.showCmd
            Case SW_SHOWNORMAL
                MsgBox "Form is shown NORMAL"
            Case SW_SHOWMAXIMIZED
                MsgBox "Form is MAXIMIZED"
            Case SW_SHOWMINIMIZED
                MsgBox "Form is MINIMIZED"
        End Select
    End Sub
    ------------------

    Serge

    Senior Programmer Analyst
    [email protected]
    [email protected]
    ICQ#: 51055819

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width