本文介绍了VB.NET-模拟MouseWheel(向前和向后)旋转{win API}的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我无法实现我的想法,请花2分钟时间回答我的问题.
这是代码;
I cant bring my idea to work, please take 2 minutes and answer my question.
Here''s the code;
Public Class Form1
Public Declare Auto Function SetCursorPos Lib "User32.dll" (ByVal X As Integer, ByVal Y As Integer) As Integer
Public Declare Auto Function GetCursorPos Lib "User32.dll" (ByRef lpPoint As Point) As Integer
Private Declare Sub mouse_event Lib "user32" Alias "mouse_event" _
(ByVal dwFlags As Integer, ByVal dx As Integer, ByVal dy As Integer, _
ByVal cButtons As Integer, ByVal dwExtraInfo As Integer)
Private Const MOUSEEVENTF_ABSOLUTE = &H8000 ' absolute move
Private Const MOUSEEVENTF_LEFTDOWN = &H2 ' left button down
Private Const MOUSEEVENTF_LEFTUP = &H4 ' left button up
Private Const MOUSEEVENTF_MOVE = &H1 ' mouse move
Private Const MOUSEEVENTF_MIDDLEDOWN = &H20
Private Const MOUSEEVENTF_MIDDLEUP = &H40
Private Const MOUSEEVENTF_RIGHTDOWN = &H8
Private Const MOUSEEVENTF_RIGHTUP = &H10
Private Const MOUSEEVENTF_WHEEL = &H20A
Private Sub mouseCommands
' Wheel Rotation Forward
' ??????????
' Wheel Rotation Backward
' ??????????
' Left Mouse-DoubleClick
mouse_event(MOUSEEVENTF_LEFTDOWN, 0, 0, 0, 0) ' Button Press
mouse_event(MOUSEEVENTF_LEFTUP, 0, 0, 0, 0) ' Button Release
mouse_event(MOUSEEVENTF_LEFTDOWN, 0, 0, 0, 0) ' Button Press
mouse_event(MOUSEEVENTF_LEFTUP, 0, 0, 0, 0) ' Button Release
' Left Mouseclick
mouse_event(MOUSEEVENTF_LEFTDOWN, 0, 0, 0, 0)
mouse_event(MOUSEEVENTF_LEFTUP, 0, 0, 0, 0)
' Right Mouseclick
mouse_event(MOUSEEVENTF_RIGHTDOWN, 0, 0, 0, 0)
mouse_event(MOUSEEVENTF_RIGHTUP, 0, 0, 0, 0)
' Middle Click
mouse_event(MOUSEEVENTF_MIDDLEDOWN, 0, 0, 0, 0)
mouse_event(MOUSEEVENTF_MIDDLEUP, 0, 0, 0, 0)
' Set Mouse Cursor to a specific position
SetCursorPos(300, 400)
' Drag and drop
SetCursorPos(300, 400) ' Where your desired file is located at(screenheight, screenwidth)
mouse_event(MOUSEEVENTF_LEFTDOWN, 0, 0, 0, 0)
SetCursorPos(500, 500) ' Where to release file, respectively the button
mouse_event(MOUSEEVENTF_LEFTUP, 0, 0, 0, 0)
End Sub
推荐答案
这篇关于VB.NET-模拟MouseWheel(向前和向后)旋转{win API}的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!