网站导航网学 原创论文 原创专题 网站设计 最新系统 原创论文 论文降重 发表论文 论文发表 UI设计定制 论文答辩PPT格式排版 期刊发表 论文专题
返回网学首页
网学原创论文
最新论文 推荐专题 热门论文 论文专题
当前位置: 网学 > 编程文档 > VB > 正文

在vb中实现鼠标手势

论文降重修改服务、格式排版等 获取论文 论文降重及排版 论文发表 相关服务
ublic Const WM_RBUTTONUP As Long = &H205
Public Const WM_MOUSEMOVE As Long = &H200
Public Const WM_MOUSEWHEEL As Long = &H20A


Public 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
Public Const MK_RBUTTON As Long = &H2
Public Declare Function ScreenToClient Lib "user32" (ByVal hwnd As Long, lpPoint As POINTAPI) As Long


Public Declare Function GetAsyncKeyState Lib "user32" (ByVal vKey As Long) As Integer
Public Const VK_LBUTTON As Long = &H1
Public Const VK_RBUTTON As Long = &H2
Public Const VK_MBUTTON As Long = &H4

Dim mPt As POINTAPI
Const ptGap As Single = 5 * 5
Dim preDir As Long
Dim mouseEventDsp As String
Dim eventLength As Long

''######### mouse hook #############

Public Sub InstallMouseHook()
    hMouseHook = SetWindowsHookEx(WH_MOUSE, AddressOf MouseHookProc, _
            App.hInstance, App.ThreadID)
End Sub

Public Function MouseHookProc(ByVal iCode As Long, ByVal wParam As Long, ByVal lParam As Long) As Long
Dim Cancel As Boolean
Cancel = False
On Error GoTo due
Dim i&
Dim nMouseInfo As MOUSEHOOKSTRUCT
Dim tHWindowFromPoint As Long
Dim tpt As POINTAPI

If iCode = HC_ACTION Then
    CopyMemory nMouseInfo, ByVal lParam, Len(nMouseInfo)
    tpt = nMouseInfo.pt
    ScreenToClient nMouseInfo.hwnd, tpt
    ''Debug.Print tpt.X, tpt.Y
    If nMouseInfo.wHitTestCode = 1 Then
        Select Case wParam
            Case WM_RBUTTONDOWN
                mPt = nMouseInfo.pt
                preDir = -1
                mouseEventDsp = ""
                Cancel = True
            Case WM_RBUTTONUP
                Debug.Print mouseEventDsp
                Cancel = True
            Case WM_MOUSEMOVE
                If vkPress(VK_RBUTTON) Then
                    Call GetMouseEvent(nMouseInfo.pt)
             &nbs
  • 上一篇资讯: vb接收GPS数据源码全
  • 设为首页 | 加入收藏 | 网学首页 | 原创论文 | 计算机原创
    版权所有 网学网 [Myeducs.cn] 您电脑的分辨率是 像素
    Copyright 2008-2020 myeducs.Cn www.myeducs.Cn All Rights Reserved 湘ICP备09003080号 常年法律顾问:王律师