首页 > 电脑

VB错误:必选参数

更新时间2018-09-26 07:36:16

代码:Private Type POINTAPI

 x As Long

 y As Long

End Type

Private Declare Function GetCursorPos Lib "user32" (lpPoint As POINTAPI) As Long


Private Sub Timer1_Timer()

 

GetCursorPos p

List2.AddItem = Time() + Chr(32) + p.x + Chr(32) + p.y

 

End Sub


'参考如下

Private Type POINTAPI

    x As Long

    y As Long

End Type

Private Declare Function GetCursorPos Lib "user32" (lpPoint As POINTAPI) As Long

Private Sub Timer1_Timer()

    Dim p As POINTAPI

    GetCursorPos p

 

    'List2.AddItem 后不能用 "=";不同类型数据不能用 "+",而应使用 "&"

    'List2.AddItem Time() & Chr(9) & "x =" & p.x & Chr(9) & "y=" & p.y

 

    '为了便于演示,这里将结果输出到 Text1

    Text1.Text = Time() & Chr(9) & "x =" & p.x & Chr(9) & "y=" & p.y

End Sub

Private Sub Form_Load()

    Timer1.Interval = 100

    Timer1.Enabled = True

End Sub


运行过程录屏

VB错误:必选参数

上一篇:visualstudio2017有什么好的入门教程

下一篇:看一下这个问题影响大吗急急急