(VB)API 函数 GetCursorPos 的问题?
PrivateStructurePOINTAPIDimxAsLongDimyAsLongEndStructurePrivateDeclareFunctionGetCurs...
Private Structure POINTAPI
Dim x As Long
Dim y As Long
End Structure
Private Declare Function GetCursorPos Lib "user32" (ByVal AP As POINTAPI) As Long
Private Sub Form1_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
Dim a As POINTAPI
GetCursorPos(a)
Bt1.Text = a.x
End Sub
这段代码那里错了?为什么有错误提示:
对 PInvoke 函数“练习!练习.Form1::GetCursorPos”的调用导致堆栈不对称。原因可能是托管的 PInvoke 签名与非托管的目标签名不匹配。请检查 PInvoke 签名的调用约定和参数与非托管的目标签名是否匹配。
我用的是VB 2005,所以你们写的代码会报错 展开
Dim x As Long
Dim y As Long
End Structure
Private Declare Function GetCursorPos Lib "user32" (ByVal AP As POINTAPI) As Long
Private Sub Form1_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
Dim a As POINTAPI
GetCursorPos(a)
Bt1.Text = a.x
End Sub
这段代码那里错了?为什么有错误提示:
对 PInvoke 函数“练习!练习.Form1::GetCursorPos”的调用导致堆栈不对称。原因可能是托管的 PInvoke 签名与非托管的目标签名不匹配。请检查 PInvoke 签名的调用约定和参数与非托管的目标签名是否匹配。
我用的是VB 2005,所以你们写的代码会报错 展开
4个回答
展开全部
Private Structure POINTAPI
Dim x As Integer
Dim y As Integer
End Structure
Private Declare Function GetCursorPos Lib "user32" (ByRef AP As POINTAPI) As Integer
Private Sub Form1_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
Dim a As POINTAPI
GetCursorPos(a)
Bt1.Text = a.x
End Sub
Dim x As Integer
Dim y As Integer
End Structure
Private Declare Function GetCursorPos Lib "user32" (ByRef AP As POINTAPI) As Integer
Private Sub Form1_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
Dim a As POINTAPI
GetCursorPos(a)
Bt1.Text = a.x
End Sub
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
Private Declare Function GetCursorPos Lib "user32" (lpPoint As POINTAPI) As Long
Private Type POINTAPI
x As Long
y As Long
End Type
Private Sub Form_Click()
Dim a As POINTAPI
GetCursorPos a
Bt1.Text =a.x
End Sub
Private Type POINTAPI
x As Long
y As Long
End Type
Private Sub Form_Click()
Dim a As POINTAPI
GetCursorPos a
Bt1.Text =a.x
End Sub
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
Private Sub Form1_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
Form1_Load()这个过程是你自已写的呢,还是默认的呢?
Form1_Load()这个过程是你自已写的呢,还是默认的呢?
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询