Here is the code required:
Public Declare Function EnumWindows Lib "user32" (ByVal lpEnumFunc As Long, ByVal lparam As Long) As Long
Public Declare Function GetWindowText Lib "user32" Alias "GetWindowTextA" (ByVal hwnd As Long, ByVal lpString As String, ByVal cch As Long) As Long
Global wwnd As Long
Public Sub CaptureWindow()
Call EnumWindows(AddressOf EnumWindowProc, 1)
End Sub
Public Function EnumWindowProc(ByVal hwnd As Long, _
ByVal lparam As Long) As Boolean
Dim sTitle As String
sTitle = Space(50)
Call GetWindowText(hwnd, sTitle, Len(sTitle))
If InStr(sTitle, "Hello") <> 0 Then 'Check for what ever is in the form title bar
EnumWindowProc = False
wwnd = hwnd
Else
EnumWindowProc = True
End If
End Function