不是像下面这句一样根据窗口标题来判断
hwnd1 = FindWindow("IEFrame", "百度——全球最大中文搜索引擎 - Microsoft Internet Explorer")
我想根据ie窗口的地址栏里的地址来判断网页是不是百度,应该咋写?最好说详细点 我很菜!谢谢
hwnd1 = FindWindow("IEFrame", "百度——全球最大中文搜索引擎 - Microsoft Internet Explorer")
我想根据ie窗口的地址栏里的地址来判断网页是不是百度,应该咋写?最好说详细点 我很菜!谢谢
Private Sub Command1_Click() Text1.Text = ""
EnumWindows AddressOf EnumProc, 0
If Text1.Text = "" Then Text1.Text = "没有启动 IE 浏览器"
End Sub注:IE8用不了
'Microsoft Internet Controls项将Internet对象引用介入到工程中。添加一个ListBox到Form1,然后在Form1中添加上面代码
Dim objShell, objWindows, objIE, strURL
strURL = "http://www.baidu.com"
Set objShell = CreateObject("Shell.Application") 'New ShellWindows
Set objWindows = objShell.Windows For Each objIE In objWindows '枚举所有已打开的ie和explore窗口
If LCase(Right(objIE.FullName, 13)) = "\iexplore.exe" Then '如果是ie窗口
If (LCase(objIE.LocationURL) = strURL) Or _
(LCase(Left(objIE.LocationURL, Len(strURL) + 1)) = strURL + "/") Then '根据网址进行判断
MsgBox "有"
Exit Sub
End If
End If
Next
Set objIE = Nothing
Set objWindows = Nothing
Set objShell = Nothing
MsgBox "没有"
End Sub