mdlWebHook.bas
资源名称:IE_VB.rar [点击查看]
上传用户:davilee3
上传日期:2015-04-22
资源大小:986k
文件大小:4k
源码类别:
浏览器
开发平台:
Visual Basic
- Attribute VB_Name = "mWebHook"
- 'Option Explicit
- '
- '
- ''Global lpPrevWebProc As Long
- ''Public gHWeb As Long
- ''Public gWebMsg As Long
- '
- '
- 'Public mHookAllForms As New Collection
- 'Dim pX As Long, pY As Long
- 'Dim afterBF As Boolean
- '
- 'Dim nowCur As Integer
- 'Dim hPreCur As Long
- '
- 'Private Const bigGap As Integer = 7
- 'Private Const smallGap As Integer = 4
- 'Private Const mGap As Integer = 2
- '
- '
- ' '以下过程为消息循环处理
- 'Private Function WindowProc(ByVal hw As Long, ByVal uMsg As Long, ByVal wParam As Long, ByVal lParam As Long) As Long
- '
- 'Dim tC As frmBrowser
- 'Set tC = mHookAllForms.Item(Str(hw))
- 'tC.hMsg = uMsg
- 'Dim xpos As Long, ypos As Long, cx As Long, cy As Long
- 'Dim isBF As Boolean
- 'Select Case uMsg
- ' Case WM_LBUTTONUP
- ' tC.nTimer = Timer
- ' Case WM_LBUTTONDOWN
- ' tC.nTimer = Timer
- ' Case WM_MOUSEMOVE
- ' If wParam = MK_RBUTTON Then
- ' Call getXY(lParam, xpos, ypos)
- ' cx = xpos - pX: cy = ypos - pY
- ' isBF = False
- ' If cx > bigGap And Abs(cy) < cx Then 'And nowCur <> 1 Then
- ' Call SetCursor(po_webmouseright.Handle)
- ' ElseIf cx < -bigGap And Abs(cy) < -cx Then 'And nowCur <> 2 Then
- ' Call SetCursor(po_webmouseleft.Handle)
- ' ElseIf cy > bigGap And Abs(cx) < cy Then 'And nowCur <> 3 Then
- ' Call SetCursor(po_webmousedown.Handle)
- ' ElseIf cy < -bigGap And Abs(cx) < -cy Then 'And nowCur <> 4 Then
- ' Call SetCursor(po_webmouseup.Handle)
- ' ElseIf Abs(cx) <= bigGap And Abs(cy) <= bigGap Then
- ' Call SetCursor(hPreCur)
- ' End If
- ' End If
- ' Case WM_RBUTTONDOWN
- ' Select Case wParam
- ' Case MK_RBUTTON
- ' hPreCur = GetCursor()
- ' SetCapture hw
- ' Call getXY(lParam, pX, pY)
- '' Case MK_RBUTTON + MK_LBUTTON, MK_RBUTTON + MK_CONTROL
- '' MDIFrmMain.unloadBrowser tC.tagIndex
- ' 'uMsg = 0 ': wParam = 0: lParam = 0
- ' End Select
- ' Case WM_RBUTTONUP
- '' If (GetAsyncKeyState(VK_MENU) And &H8000) <> 0 _
- '' And (GetAsyncKeyState(VK_CONTROL) And &H8000) <> 0 Then
- '' MDIFrmMain.unloadBrowser tC.tagIndex
- '' End If
- '
- '
- '
- ' Select Case wParam
- ' Case 0
- ' Call SetCursor(hPreCur)
- ' Call getXY(lParam, xpos, ypos)
- ' cx = xpos - pX: cy = ypos - pY
- ' isBF = False
- ' If cx > bigGap And Abs(cy) < cx Then
- ' Call tC.callGo(1)
- ' isBF = True
- ' ElseIf cx < -bigGap And Abs(cy) < -cx Then
- ' Call tC.callGo(-1)
- ' isBF = True
- ' ElseIf cy > bigGap And Abs(cx) < cy Then
- ' Call MDIFrmMain.NextLastTab(True)
- ' isBF = True
- ' ElseIf cy < -bigGap And Abs(cx) < -cy Then
- ' Call MDIFrmMain.NextLastTab(False)
- ' isBF = True
- ' End If
- '
- ' If isBF Then
- ' uMsg = 0
- ' 'wParam = 0: lParam = 0 ': afterBF = True
- ' End If
- ' Case MK_LBUTTON, MK_CONTROL
- ' MDIFrmMain.unloadBrowser tC.tagIndex
- ' End Select
- '
- ' Call ReleaseCapture
- '
- '
- '
- ' 'Case WM_MBUTTONDBLCLK
- ' ' MDIFrmMain.unloadBrowser tC.tagIndex
- ' Case WM_MBUTTONDOWN
- ' uMsg = WM_LBUTTONDOWN
- ' Case WM_MBUTTONUP
- ' uMsg = WM_LBUTTONUP
- 'End Select
- 'WindowProc = CallWindowProc(tC.lpPrevWebProc, hw, uMsg, wParam, lParam)
- 'End Function
- '
- 'Public Sub webHook(gHWeb As Long, lpPrevWebProc As Long) '将程序勾入消息环中
- ' '利用AddressOf取得消息处理函数WindowProc的指针,并将其传给SetWindowLong
- ' 'lpPrevWndProc用来存储原窗口的指针
- ' lpPrevWebProc = SetWindowLong(gHWeb, GWL_WNDPROC, AddressOf WindowProc)
- 'End Sub
- '
- 'Public Sub webUnhook(gHWeb As Long, lpPrevWebProc As Long)
- ''将程序从消息环退出。用原窗口的指针替换WindowProc函数的指针,即关闭子类、退出消息循环
- ' Dim temp As Long
- ' temp = SetWindowLong(gHWeb, GWL_WNDPROC, lpPrevWebProc)
- 'End Sub
- '
- 'Private Function getXY(lParam As Long, xpos As Long, ypos As Long) As Boolean
- 'xpos = lParam And &H8000FFFF
- 'ypos = (lParam And &HFFFF0000) / &H10000
- 'End Function
- '
- '