這是VB6的作法:
Dim lnghWnd As Long
Dim strTmp As String * 256
Dim strCaption As String
strCaption = "Microsoft Internet Explorer"
lnghWnd = GetWindow(GetDesktopWindow, GW_CHILD)
lnghWnd = GetWindow(lnghWnd, GW_HWNDFIRST)
Do While lnghWnd
GetWindowText lnghWnd, strTmp, 256
If InStr(strTmp, "你的Erp窗體名稱") Then
Msgbox "哈哈,找到你了"
Exit Do
End If
lnghWnd = GetWindow(lnghWnd, GW_HWNDNEXT)
Loop