Private
Function
SearchHndByWndName_Parent(strSearch
As
String
)
As
Long
Dim
strTmp
As
String
* 200
Dim
nhWnd
As
Long
nhWnd = FindWindow(vbNullString, vbNullString)
Do
While
Not
nhWnd = 0
If
GetParent(nhWnd) = 0
Then
GetWindowText nhWnd, strTmp, 200
If
InStr(strTmp, <strong>Left(strSearch, 200)</strong>) > 0
Then
SearchHndByWndName_Parent = nhWnd
Exit
Do
End
If
End
If
nhWnd = GetWindow(nhWnd, GW_HWNDNEXT)
Loop
End
Function