Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- 'Created By Hydrotronics
- Public Class VirtualInput
- Const LeftDown = &H2
- Const LeftUp = &H4
- Const MiddleDown = &H20
- Const MiddleUp = &H40
- Const RightDown = &H8
- Const RightUp = &H10
- Const Wheel As Integer = &H800
- Const appCommand As UInteger = &H319
- Const volumeUp As UInteger = &HA
- Const volumeDown As UInteger = &H9
- Const volumeMute As UInteger = &H8
- Private Declare Auto Function SetCursorPos Lib "User32.dll" (ByVal X As Integer, ByVal Y As Integer) As Integer
- Private Declare Auto Function GetCursorPos Lib "User32.dll" (ByRef lpPoint As System.Drawing.Point) As Integer
- Private Declare Sub mouseclick 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 Function SendMessage(ByVal hWnd As IntPtr, ByVal Msg As UInteger, ByVal wParam As IntPtr, ByVal lParam As IntPtr) As IntPtr
- End Function
- Public Shared Function SetMousePosition(ByVal x As Integer, ByVal y As Integer) As Boolean
- SetCursorPos(x, y)
- Return True
- End Function
- Public Shared Function GetMousePosition() As System.Drawing.Point
- Dim pos As New System.Drawing.Point()
- Dim R As Long = GetCursorPos(pos)
- Return pos
- End Function
- Public Shared Function LeftClick() As Boolean
- mouseclick(LeftDown, 0, 0, 0, 0)
- mouseclick(LeftUp, 0, 0, 0, 0)
- Return True
- End Function
- Public Shared Function LeftClick(ByVal IsDouble As Boolean) As Boolean
- mouseclick(LeftDown, 0, 0, 0, 0)
- mouseclick(LeftUp, 0, 0, 0, 0)
- If IsDouble Then
- mouseclick(LeftDown, 0, 0, 0, 0)
- mouseclick(LeftUp, 0, 0, 0, 0)
- End If
- Return True
- End Function
- Public Shared Function RightClick() As Boolean
- mouseclick(RightDown, 0, 0, 0, 0)
- mouseclick(RightUp, 0, 0, 0, 0)
- Return True
- End Function
- Public Shared Function RightClick(ByVal IsDouble As Boolean) As Boolean
- mouseclick(RightDown, 0, 0, 0, 0)
- mouseclick(RightUp, 0, 0, 0, 0)
- If IsDouble Then
- mouseclick(RightDown, 0, 0, 0, 0)
- mouseclick(RightUp, 0, 0, 0, 0)
- End If
- Return True
- End Function
- Public Shared Function MiddleClick() As Boolean
- mouseclick(MiddleDown, 0, 0, 0, 0)
- mouseclick(MiddleUp, 0, 0, 0, 0)
- Return True
- End Function
- Public Shared Function MiddleClick(ByVal IsDouble As Boolean) As Boolean
- mouseclick(MiddleDown, 0, 0, 0, 0)
- mouseclick(MiddleUp, 0, 0, 0, 0)
- If IsDouble Then
- mouseclick(MiddleDown, 0, 0, 0, 0)
- mouseclick(MiddleUp, 0, 0, 0, 0)
- End If
- Return True
- End Function
- Public Shared Function DragTo(ByVal x As Integer, ByVal y As Integer) As Boolean
- mouseclick(LeftDown, 0, 0, 0, 0)
- SetCursorPos(x, y)
- mouseclick(LeftUp, 0, 0, 0, 0)
- Return True
- End Function
- Public Shared Function ScrollDown(ByVal clicks As Integer) As Boolean
- mouseclick(Wheel, 0, 0, -(clicks * 120), 0)
- Return True
- End Function
- Public Shared Function ScrollUp(ByVal clicks As Integer) As Boolean
- mouseclick(Wheel, 0, 0, clicks * 120, 0)
- Return True
- End Function
- Public Shared Function QueueKeypress(ByVal Key As String) As Boolean
- SendKeys.Send(Key)
- Return True
- End Function
- Public Function RaiseLocalVolume(ByVal amount As Integer, ByVal Instance As Form)
- SendMessage(Instance.Handle, appCommand, &H30292, volumeUp * &H10000)
- Return True
- End Function
- Public Function LowerLocalVolume(ByVal amount As Integer, ByVal Instance As Form)
- SendMessage(Instance.Handle, appCommand, &H30292, volumeDown * &H10000)
- Return True
- End Function
- Public Function MuteLocalVolume(ByVal Instance As Form)
- SendMessage(Instance.Handle, appCommand, &H200EB0, volumeMute * &H10000)
- Return True
- End Function
- End Class
Advertisement
Add Comment
Please, Sign In to add comment