You could use the EnumWindows API.
Put the following in a Module:
Put a CommandButton on the Form with the following code in it.Code:Declare Function GetWindowText Lib "user32" Alias "GetWindowTextA" (ByVal hwnd As Long, ByVal lpString As String, ByVal cch As Long) As Long Declare Function GetWindowTextLength Lib "user32" Alias "GetWindowTextLengthA" (ByVal hwnd As Long) As Long Declare Function EnumWindows Lib "user32.dll" (ByVal lpEnumFunc As Long, ByVal lParam As Long) As Long Public Function EnumWindowsProc(ByVal hwnd As Long, ByVal lParam As Long) As Long Dim Length As Long Dim Buffer As String Dim Temp As String Static iCount As Integer iCount = iCount + 1 Length = GetWindowTextLength(hwnd) + 1 If Length > 1 Then Buffer = Space(Length) GetWindowText hwnd, Buffer, Length Temp = Left(Buffer, Length - 1) If Temp = "Tips" Then MsgBox ("Window Found") End If EnumWindowsProc = 1 End Function
Code:EnumWindows AddressOf EnumWindowsProc, 0




Reply With Quote