《VB获取任意时刻鼠标位置》由会员分享,可在线阅读,更多相关《VB获取任意时刻鼠标位置(2页珍藏版)》请在金锄头文库上搜索。
VB获取任意时刻鼠标位置:界面如下:代码如下:(注意: Timer 的间隔设置为100)Private Declare Function GetCursorPos Lib “user32“ (lpPoint As POINTAPI) As Long Private Type POINTAPI x As Long y As Long End Type Private Sub Timer1_Timer() Dim p As POINTAPI GetCursorPos p label2.Caption = p.x & “,“ & p.y End Sub Private Sub Command1_Click() Unload Me End Sub 运行效果如下: