cBHO.cls
资源名称:IE_VB.rar [点击查看]
上传用户:davilee3
上传日期:2015-04-22
资源大小:986k
文件大小:2k
源码类别:
浏览器
开发平台:
Visual Basic
- VERSION 1.0 CLASS
- BEGIN
- MultiUse = -1 'True
- Persistable = 0 'NotPersistable
- DataBindingBehavior = 0 'vbNone
- DataSourceBehavior = 0 'vbNone
- MTSTransactionMode = 0 'NotAnMTSObject
- END
- Attribute VB_Name = "cBHO"
- Attribute VB_GlobalNameSpace = False
- Attribute VB_Creatable = True
- Attribute VB_PredeclaredId = False
- Attribute VB_Exposed = True
- Option Explicit
- ' interfaces
- Implements IObjectWithSite
- ' private variables
- Private moUnknown As IUnknownVB
- Private WithEvents moBrowser As InternetExplorer
- Attribute moBrowser.VB_VarHelpID = -1
- Private mIsIE As Boolean
- Private Sub Class_Initialize()
- 'Load frmDebug
- 'ShowWindow frmDebug.hwnd, SW_NORMAL
- End Sub
- ' called when the parent wants
- ' to know what we're aiming at
- Private Sub IObjectWithSite_GetSite(ByVal priid As VBShellLib.REFIID, ppvObj As VBShellLib.VOID)
- ' return the interface we've got
- If Not (moUnknown Is Nothing) Then
- moUnknown.QueryInterface priid, ppvObj
- End If
- End Sub
- ' called on init to give us a
- ' pointer to the parent browser
- Private Sub IObjectWithSite_SetSite(ByVal pSite As VBShellLib.IUnknownVB)
- ' store the unknown
- Set moUnknown = pSite
- ' since this method is called again
- ' when the BHO is unloaded, we have to
- ' release our pointer
- If ObjPtr(pSite) = 0 Then
- CopyMemory moBrowser, 0&, 4
- Else
- ' get the IWebBrowser2 interface
- Set moBrowser = moUnknown
- Set IEBrowser = moBrowser
- mIsIE = (GetClassNameVb(moBrowser.hwnd) = ClassName_IEFrm)
- If mIsIE Then
- Call InstallMouseHook
- ' Load frmDebug
- ' ShowWindow frmDebug.hwnd, SW_NORMAL
- End If
- End If
- End Sub
- Private Sub moBrowser_NewWindow2(ppDisp As Object, Cancel As Boolean)
- On Error Resume Next
- Dim tDoc As Object
- Set tDoc = moBrowser.document
- Cancel = tDoc Is Nothing And Not vkPress(VK_CONTROL)
- End Sub
- Private Sub moBrowser_OnQuit()
- If mIsIE Then
- Call UninstallMouseHook
- Set IEBrowser = Nothing
- End If
- End Sub