0
我試圖獲得使用GetCursorPos我的光標的位置,但它給我的錯誤光標位置給PInvokeStackImbalance錯誤
Managed Debugging Assistant 'PInvokeStackImbalance' : 'A call to PInvoke function 'MoveClickApp!MoveClickApp.Module1::GetCursorPos' has unbalanced the stack. This is likely because the managed PInvoke signature does not match the unmanaged target signature. Check that the calling convention and parameters of the PInvoke signature match the target unmanaged signature.'
我無法弄清楚這意味着什麼或如何進行。有任何想法嗎?
Public Declare Function GetCursorPos Lib "user32" (ByVal lpPoint As POINTAPI) As UInt32
Public Structure POINTAPI
Dim x As UInt32
Dim y As UInt32
End Structure
Public Function GetX() As UInt32
Dim n As POINTAPI
GetCursorPos(n)
GetX = n.x
End Function
Public Function GetY() As UInt32
Dim n As POINTAPI
GetCursorPos(n)
GetY = n.y
End Function
替代這種方法也可以,你也應該使用Integer
類型x和y,不UINT32讚賞
這有幫助!我實際上沒有看到這些<>命令不是編組vb之前,所以這是我需要查找完全理解。奇怪的是,這個修復程序使得一個無關的SetCursorPos命令現在發生了故障,但我會嘗試自己弄清楚。謝謝您的幫助 – Zyzyx