求助:::::::vb问题??????

来源:百度知道 编辑:UC知道 时间:2024/06/17 18:12:06
Private Declare Function GetCursorPos Lib "user32" (lpPoint As PointAPI) As Long

Private Type PointAPI
X As Long
Y As Long
End Type

Dim ScreenPoint As PointAPI
GetCursorPos ScreenPoint(ScreenPoint.X, creenpoint.Y)
一运行显示类型未定义 怎么解决呢?

即使如一楼所说,代码运行仍有错误,代码修改如下:
Option Explicit
Private Declare Function GetCursorPos Lib "user32" (lpPoint As PointAPI) As Long
Private Type PointAPI
X As Long
Y As Long
End Type
Dim ScreenPoint As PointAPI

Private Sub Form_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
Cls
GetCursorPos ScreenPoint
Print ScreenPoint.X * Screen.TwipsPerPixelX
Print ScreenPoint.Y * Screen.TwipsPerPixelY
End Sub

GetCursorPos ScreenPoint(ScreenPoint.X, Screenpoint.Y)
这里是调用不要参数的函数 GetCursorPos,不要括号以及里面的内容

ScreenPoint.X, creenpoint.Y
--->少写了个“S”
ScreenPoint.X, Screenpoint.Y