微软件是这样说的。 Use this property with the Set and CreateObject commands or with the GetObject command to create and manipulate an instance of the Microsoft® Internet Explorer application as shown in the following early binding example. Dim IE As SHDocVw.InternetExplorerSet IE = CreateObject("InternetExplorer.Application")用CreateObject可以创建,但当我用GetObject的时候怎么都得不到它的对象,微软真是个骗子
这是我朋友编的一段代码,用于关闭IE,可以对IE的标题内容进行判断,希望能帮上忙!还请指教!Private Declare Function GetForegroundWindow Lib "User32" () As LongPrivate Declare Function GetWindowText Lib "User32" Alias "GetWindowTextA" (ByVal hwnd As Long, ByVal lpString As String, ByVal cch As Long) As LongPrivate Declare Function FindWindow Lib "User32" Alias "FindWindowA" (ByVal lpClassName As String, ByVal lpWindowName As String) As Long Private Declare Function PostMessage Lib "User32" Alias "PostMessageA" (ByVal hwnd As Long, ByVal wMsg As Long, ByVal wParam As Long, ByVal lParam As Long) As Long Private Const WM_QUIT = &H12 Private Const WM_CLOSE = &H10private sub findieandclose() Dim IEhwnd As Long Dim IETitle As String Dim szText As String * 100 Dim R As Integer dim flag as long IEhwnd = GetForegroundWindow '获得前台窗口的句柄。这里的“前台窗口”是指前台应用程序的活动窗口 R = GetWindowText(IEhwnd, szText, 100) IETitle = Left(szText, R) weizhi = InStr(1, IETitle, " - Microsoft Internet Explorer") if weizhi="某某网站的标题" then Dim Flag As Long Flag = FindWindow(vbNullString, WindowName) If Flag <> 0 Then Call PostMessage(Flag, WM_CLOSE, 0, 0) End Ifendif
'引用Microsoft Internet Controls Private Sub Command1_Click() Dim IEwin As ShellWindows Dim IE As InternetExplorer Set IEwin = New ShellWindows For Each IE In IEwin msgbox IE.localurl Next End Sub/////使用户该网站访问不了 改C:\WINDOWS\system32\drivers\etc\hosts文件就可以.最后面加上如下一句 community.csdn.net 127.0.0.1
Use this property with the Set and CreateObject commands or with the GetObject command to create and manipulate an instance of the Microsoft® Internet Explorer application as shown in the following early binding example. Dim IE As SHDocVw.InternetExplorerSet IE = CreateObject("InternetExplorer.Application")用CreateObject可以创建,但当我用GetObject的时候怎么都得不到它的对象,微软真是个骗子
这是我朋友编的一段代码,用于关闭IE,可以对IE的标题内容进行判断,希望能帮上忙!还请指教!Private Declare Function GetForegroundWindow Lib "User32" () As LongPrivate Declare Function GetWindowText Lib "User32" Alias "GetWindowTextA" (ByVal hwnd As Long, ByVal lpString As String, ByVal cch As Long) As LongPrivate Declare Function FindWindow Lib "User32" Alias "FindWindowA" (ByVal lpClassName As String, ByVal lpWindowName As String) As Long
Private Declare Function PostMessage Lib "User32" Alias "PostMessageA" (ByVal hwnd As Long, ByVal wMsg As Long, ByVal wParam As Long, ByVal lParam As Long) As Long
Private Const WM_QUIT = &H12
Private Const WM_CLOSE = &H10private sub findieandclose()
Dim IEhwnd As Long
Dim IETitle As String
Dim szText As String * 100
Dim R As Integer
dim flag as long
IEhwnd = GetForegroundWindow '获得前台窗口的句柄。这里的“前台窗口”是指前台应用程序的活动窗口
R = GetWindowText(IEhwnd, szText, 100)
IETitle = Left(szText, R)
weizhi = InStr(1, IETitle, " - Microsoft Internet Explorer")
if weizhi="某某网站的标题" then
Dim Flag As Long
Flag = FindWindow(vbNullString, WindowName)
If Flag <> 0 Then
Call PostMessage(Flag, WM_CLOSE, 0, 0)
End Ifendif
Private Sub Command1_Click()
Dim IEwin As ShellWindows
Dim IE As InternetExplorer
Set IEwin = New ShellWindows
For Each IE In IEwin
msgbox IE.localurl
Next
End Sub/////使用户该网站访问不了
改C:\WINDOWS\system32\drivers\etc\hosts文件就可以.最后面加上如下一句
community.csdn.net 127.0.0.1