mReBarHook.bas
资源名称:IE_VB.rar [点击查看]
上传用户:davilee3
上传日期:2015-04-22
资源大小:986k
文件大小:2k
源码类别:
浏览器
开发平台:
Visual Basic
- Attribute VB_Name = "mReBarHook"
- Option Explicit
- Public lpPrevRbProc As Long
- Private Function WindowProc(ByVal hw As Long, ByVal uMsg As Long, ByVal wParam As Long, ByVal lParam As Long) As Long
- Select Case uMsg
- Case WM_RBUTTONUP
- gMainForm.popMenuLockToolBar
- Case WM_SIZE
- ' Dim tRt As RECT
- ' GetWindowRect hw, tRt
- ' gMainForm.pctReBar.Height = (tRt.Bottom - tRt.Top) * 15
- 'gMainForm.pctReBar.Height = gMainForm.myRebar.GetHeight * 15
- Dim tw As Long
- tw = (lParam And &HFFFF0000) / &H10000
- If tw >= 0 Then
- gMainForm.pctReBar.Height = (tw + 4) * 15
- If tw = 0 Then
- gMainForm.pctReBar.Visible = False
- Else
- If Not gFullScreenMode Then
- gMainForm.pctReBar.Visible = True
- End If
- End If
- End If
- 'WindowProc = CallWindowProc(lpPrevRbProc, hw, uMsg, wParam, lParam)
- Case Else '调用缺省窗口指针
- 'WindowProc = CallWindowProc(lpPrevRbProc, hw, uMsg, wParam, lParam)
- End Select
- WindowProc = CallWindowProc(lpPrevRbProc, hw, uMsg, wParam, lParam)
- End Function
- Public Sub rbhook(ByVal hw As Long) '将程序勾入消息环中
- '利用AddressOf取得消息处理函数WindowProc的指针,并将其传给SetWindowLong
- 'lpPrevWndProc用来存储原窗口的指针
- lpPrevRbProc = SetWindowLong(hw, GWL_WNDPROC, AddressOf WindowProc)
- End Sub
- Public Sub rbUnhook(ByVal hw As Long)
- '将程序从消息环退出。用原窗口的指针替换WindowProc函数的指针,即关闭子类、退出消息循环
- Call SetWindowLong(hw, GWL_WNDPROC, lpPrevRbProc)
- End Sub