Code: Select all
Procedure x_findwindow(pattern.s,ulcase)
Protected n
Global x_window_name.s, x_window_h
;
; in: pattern.s - see x_matchpattern()
; ulcase - 1 don't check case 0 check case
; retval: #true - found
; out: x_window_name - name of the window found
; x_window_h - handle of the window found
;
n = 0
x_window_h = 0
h = GetTopWindow_(0)
While h <> 0
x_window_name = Space(513)
GetWindowText_(h,@x_window_name,512)
n = n+1
If n > 5000 ; on tinman's request :-)
h = 0
ElseIf x_matchpattern(x_window_name,pattern,ulcase) = #True
x_window_h = h
h = 0
Else
h = GetWindow_(h,#GW_HWNDNEXT)
EndIf
Wend
;
If x_window_h <> 0
ProcedureReturn #True
Else
ProcedureReturn #False
EndIf
EndProcedure