2个回答
2013-08-12
展开全部
API函数
Option Explicit
Public Declare Function CallWindowProc Lib "user32" Alias "CallWindowProcA" (ByVal lpPrevWndFunc As Long, ByVal hwnd As Long, ByVal Msg As Long, ByVal wParam As Long, ByVal lParam As Long) As Long
Public Declare Function SetWindowLong Lib "user32" Alias "SetWindowLongA" (ByVal hwnd As Long, ByVal nIndex As Long, ByVal dwNewLong As Long) As Long
Public Declare Function GetWindowLong Lib "user32" Alias "GetWindowLongA" (ByVal hwnd As Long, ByVal nIndex As Long) As Long
Public Const GWL_WNDPROC = (-4)
Public Const WM_USER = &H400
Public Const WM_MBUTTONDBLCLK = &H209
Public Const WM_MBUTTONDOWN = &H207
Public Const WM_MBUTTONUP = &H208
Public Const WM_LBUTTONUP = &H202
Public Const WM_LBUTTONDOWN = &H201
Public Const WM_LBUTTONDBLCLK = &H203
Public Const WM_RBUTTONDBLCLK = &H206
Public Const WM_RBUTTONDOWN = &H204
Public Const WM_RBUTTONUP = &H205
Public OldWindowProc As Long
Public Myform As Form
Public AA As Long
Public Sub CheckMouse(A As Form)
Set Myform = A
OldWindowProc = GetWindowLong(Myform.hwnd, GWL_WNDPROC)
SetWindowLong Myform.hwnd, GWL_WNDPROC, AddressOf NewWindowProc
End Sub
Public Function NewWindowProc(ByVal hwnd As Long, ByVal Msg As Long, ByVal wParam As Long, ByVal lParam As Long) As Long
Select Case Msg
Case WM_LBUTTONUP
Form1.Text1.Text = Form1.Text1.Text + "LBUTTONUP"
Case WM_LBUTTONDOWN
Form1.Text1.Text = "LBUTTONDOWN"
Case WM_LBUTTONDBLCLK
Form1.Text1.Enabled = True
Case WM_RBUTTONDBLCLK
Form1.Text1.Enabled = False
Case WM_RBUTTONDOWN
Form1.Text1.Text = "RBUTTONDOWN"
Case WM_RBUTTONUP
Form1.Text1.Text = "RBUTTONUP"
End Select
NewWindowProc = CallWindowProc(OldWindowProc, hwnd, Msg, wParam, lParam)
End Function
ForM_load()
checkMouse form1
end sub
Option Explicit
Public Declare Function CallWindowProc Lib "user32" Alias "CallWindowProcA" (ByVal lpPrevWndFunc As Long, ByVal hwnd As Long, ByVal Msg As Long, ByVal wParam As Long, ByVal lParam As Long) As Long
Public Declare Function SetWindowLong Lib "user32" Alias "SetWindowLongA" (ByVal hwnd As Long, ByVal nIndex As Long, ByVal dwNewLong As Long) As Long
Public Declare Function GetWindowLong Lib "user32" Alias "GetWindowLongA" (ByVal hwnd As Long, ByVal nIndex As Long) As Long
Public Const GWL_WNDPROC = (-4)
Public Const WM_USER = &H400
Public Const WM_MBUTTONDBLCLK = &H209
Public Const WM_MBUTTONDOWN = &H207
Public Const WM_MBUTTONUP = &H208
Public Const WM_LBUTTONUP = &H202
Public Const WM_LBUTTONDOWN = &H201
Public Const WM_LBUTTONDBLCLK = &H203
Public Const WM_RBUTTONDBLCLK = &H206
Public Const WM_RBUTTONDOWN = &H204
Public Const WM_RBUTTONUP = &H205
Public OldWindowProc As Long
Public Myform As Form
Public AA As Long
Public Sub CheckMouse(A As Form)
Set Myform = A
OldWindowProc = GetWindowLong(Myform.hwnd, GWL_WNDPROC)
SetWindowLong Myform.hwnd, GWL_WNDPROC, AddressOf NewWindowProc
End Sub
Public Function NewWindowProc(ByVal hwnd As Long, ByVal Msg As Long, ByVal wParam As Long, ByVal lParam As Long) As Long
Select Case Msg
Case WM_LBUTTONUP
Form1.Text1.Text = Form1.Text1.Text + "LBUTTONUP"
Case WM_LBUTTONDOWN
Form1.Text1.Text = "LBUTTONDOWN"
Case WM_LBUTTONDBLCLK
Form1.Text1.Enabled = True
Case WM_RBUTTONDBLCLK
Form1.Text1.Enabled = False
Case WM_RBUTTONDOWN
Form1.Text1.Text = "RBUTTONDOWN"
Case WM_RBUTTONUP
Form1.Text1.Text = "RBUTTONUP"
End Select
NewWindowProc = CallWindowProc(OldWindowProc, hwnd, Msg, wParam, lParam)
End Function
ForM_load()
checkMouse form1
end sub
黄先生
2024-12-27 广告
2024-12-27 广告
矩阵切换器就是将一路或多路视音频信号分别传输给一个或者多个显示设备,如两台电脑主机要共用一个显示器,矩阵切换器可以将两台电脑主机上的内容renyi切换到同一个或多个显示器上;迈拓维矩矩阵切换器种类齐全,性价比高,支持多种控制方式,为工程商采...
点击进入详情页
本回答由黄先生提供
2013-08-12
展开全部
Private sub form_MOUSEdown(button as integer)
if button=1 then '1按住左键
Msgbox "你按住的为左键"
else
Msgbox "你按住的为右键"
END SUB
if button=1 then '1按住左键
Msgbox "你按住的为左键"
else
Msgbox "你按住的为右键"
END SUB
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询