请问如何写一个VB程序来检测当前鼠标指针?
鼠标在编辑框上时是编辑状态,在其它控件上时是正常状态,请问如何用VB写一个程序来检测当前鼠标指针的状态呢?找了好多资料都没有结果,请大家赐教!谢谢!你好,我说的是判断鼠标...
鼠标在编辑框上时是编辑状态,在其它控件上时是正常状态,请问如何用VB写一个程序来检测当前鼠标指针的状态呢?找了好多资料都没有结果,请大家赐教!谢谢!
你好,我说的是判断鼠标指针的状态,而你给的源码是判断鼠标的位置,请问有别的办法吗? 展开
你好,我说的是判断鼠标指针的状态,而你给的源码是判断鼠标的位置,请问有别的办法吗? 展开
1个回答
展开全部
要用到API函数
Option Explicit
Private Type POINTAPI
X As Long
Y As Long
End Type
Private Declare Function GetCursorPos Lib "user32" (lpPoint As POINTAPI) As Long
Private Sub Form_Load()
Timer1.Interval = 10
End Sub
Private Sub Timer1_Timer()
Dim A As POINTAPI
GetCursorPos A
Cls
Form1.Print A.X
Form1.Print A.Y
End Sub
Option Explicit
Private Type POINTAPI
X As Long
Y As Long
End Type
Private Declare Function GetCursorPos Lib "user32" (lpPoint As POINTAPI) As Long
Private Sub Form_Load()
Timer1.Interval = 10
End Sub
Private Sub Timer1_Timer()
Dim A As POINTAPI
GetCursorPos A
Cls
Form1.Print A.X
Form1.Print A.Y
End Sub
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询