下列代码在窗体内和窗体外用API均可获得其句柄值:Option Explicit '设置新鼠标指针,并返回成功后的句柄 Private Declare Function SetCursor Lib "user32.dll" (ByVal hCursor As Long) As Long '取得当前鼠标指针的句柄 Private Declare Function GetCursor Lib "user32.dll" () As LongPrivate Sub Form_Load() timer1.Enabled = True timer1.Interval = 100 End SubPrivate Sub Timer1_Timer() '65553为标准鼠标箭头 '65567为左右箭头 '65569为上下箭头 Debug.Print GetCursor End Sub
MousePointer 属性
返回或设置一个值,该值指示在运行时当鼠标移动到对象的一个特定部分时,被显示的鼠标指针的类型。
语法
object.MousePointer [= value]部分 描述
object 对象表达式,其值是“应用于”列表中的一个对象。
value 整数,按照设置值中的描述指定被显示的鼠标指针类型。
例:Screen.MousePointer = 11'沙漏(表示等待状态)
Screen.MousePointer = 1'箭头
'设置新鼠标指针,并返回成功后的句柄
Private Declare Function SetCursor Lib "user32.dll" (ByVal hCursor As Long) As Long
'取得当前鼠标指针的句柄
Private Declare Function GetCursor Lib "user32.dll" () As LongPrivate Sub Form_Load()
timer1.Enabled = True
timer1.Interval = 100
End SubPrivate Sub Timer1_Timer()
'65553为标准鼠标箭头
'65567为左右箭头
'65569为上下箭头
Debug.Print GetCursor
End Sub