

Which is a variable limited by the user, for mouse wheel. This allows you to smoothly increment the scrollbar, instead of relying on the inconsistent wheel delta, The scroll value can actually be any value larger than 1, if used within a loop. Mouse_event(&H800, 0, 0, ScrollValue, 0) Tips & Tricks: ScrollValue = 120 'or -120 for up or down scrolling but here is how you do the mouse scroll button Searching for this information wasn't easy. However you have to keep in mind to add the namespace "" and keep in mind to write the code into a class. The dwExtraInfo appears to be a ULONG_PTR in C++ ( IntPtr in VB.NET)ĭeclare Function apimouse_event Lib "user32.dll" Alias "mouse_event" (ByVal dwFlags As Int32, ByVal dX As Int32, ByVal dY As Int32, ByVal cButtons As Int32, ByVal dwExtraInfo As Int32) As BooleanįYI, Microsoft tells us for "Windows NT/2000/XP: This function has been superseded. If there is a real error, it will in fact return a value of false, or zero. This function does indeed return a value, just as the keybd_event API does. Public enum MouseEventDataXButtons : uint MouseEventFlags.XUP for the dwFlags parameter. to specify an X button when using MouseEventFlags.XDOWN or Use the values of this enum for the 'dwData' parameter User-Defined Constants:Ĭonst uint MOUSEEVENTF_ABSOLUTE = 0x8000 Ĭonst uint MOUSEEVENTF_LEFTDOWN = 0x0002 Ĭonst uint MOUSEEVENTF_MIDDLEDOWN = 0x0020 Ĭonst uint MOUSEEVENTF_MIDDLEUP = 0x0040 Ĭonst uint MOUSEEVENTF_RIGHTDOWN = 0x0008

As such, the "uint" type specification for C# can be safely replaced with Int32. if MOUSEEVENTF_ABSOLUTE is not specified as part of dwFlags), negative values for dx and dy are desirable. Note that for non-relative mouse movement (i.e. Public Declare Sub mouse_event Lib "user32" (ByVal dwFlags As Long, ByVal dx As Long, ByVal dy As Long, ByVal dwData As Long, ByVal dwExtraInfo As Long) Private Shared Sub mouse_event(dwFlags As UInteger, dx As UInteger, dy As UInteger, dwData As UInteger, dwExtraInfo As Integer) Static extern void mouse_event(uint dwFlags, int dx, int dy, uint dwData,


This function is useful to simulate mouse buttons and wheel event to screen.
