vb.net gettouchinputinfo函数怎么用
时间: 2023-05-22 10:04:01 浏览: 178
xp下实现多点触控
4星 · 用户满意度95%
可以通过以下方式来使用 vb.net gettouchinputinfo 函数:
1.首先,需要导入 System.Runtime.InteropServices 命名空间。
2.然后,可以定义以下结构体:
<StructLayout(LayoutKind.Sequential)>
Structure TOUCHINPUT
Public x As Integer
Public y As Integer
Public hSource As IntPtr
Public dwID As Integer
Public dwFlags As Integer
Public dwMask As Integer
Public dwTime As Integer
Public dwExtraInfo As IntPtr
Public cxContact As Integer
Public cyContact As Integer
End Structure
3.接下来,可以定义以下函数:
Declare Function GetTouchInputInfo Lib "user32.dll" (ByVal hTouchInput As IntPtr, ByVal cInputs As Integer, ByVal pInputs As TOUCHINPUT(), ByVal cbSize As Integer) As Boolean
4.最后,可以使用以下代码调用 GetTouchInputInfo 函数:
Dim touchInputs(10) As TOUCHINPUT
Dim touchInputSize As Integer = Marshal.SizeOf(GetType(TOUCHINPUT))
Dim inputCount As Integer = GetTouchInputInfo(hTouchInput, touchInputs.Length, touchInputs, touchInputSize)
注意:以上代码的 hTouchInput 参数需要根据具体情况进行设置。
阅读全文