[Only registered and activated users can see links. Click Here To Register...]
[Only registered and activated users can see links. Click Here To Register...]
At the begining sorry for my bad speling...
I decided to contribute to the comunity and help some people wich are begining to program in VB with some usefull stuff I know. Also I would like to encurage all the VB programers in this forum to post programs and short tutorials in this topic so that we make a good usefull VB library ;)
I will start with small programs and go big and add new tool with tutorial when I have time. If this topic spreads in more pages list thro them all because I will post new tools with How To in diferent posts. I hope my work will be found usefull and will help some coding beginers.
--------------------------------------------------------------------------
Program no.1: AutoScater
1. Open new project and add new module. In the module paste this.
The mouse_event and SetCursorPos are used to control the mouse. GetCursorPos is used to return you the curent position of your mouse.
How to control the mouse? Lets say you want to move the cursol to pixel coordinates 500, 500 and click. You simply call...
On the main form add a timer and set its "Interval" value to 150. This will call the code under timer every 0.15 sec, In our case will autoclick if you hold the right button every 0.15 sec. I set it to so low because i dont know the minimum time between 2 scaters and I dont want to miss any 0.1 sec :D
Now under timer add this code:
Now compile and vala... you have an AutoScater wich will constantly press righ mouse button whyle you hold it.
I hope this helped some people... More will come ;)
[Only registered and activated users can see links. Click Here To Register...]
At the begining sorry for my bad speling...
I decided to contribute to the comunity and help some people wich are begining to program in VB with some usefull stuff I know. Also I would like to encurage all the VB programers in this forum to post programs and short tutorials in this topic so that we make a good usefull VB library ;)
I will start with small programs and go big and add new tool with tutorial when I have time. If this topic spreads in more pages list thro them all because I will post new tools with How To in diferent posts. I hope my work will be found usefull and will help some coding beginers.
--------------------------------------------------------------------------
Program no.1: AutoScater
1. Open new project and add new module. In the module paste this.
The first GetAsyncKeyState function is used to get the current state of a key. This works with any key on keyboard as well as with the mouse.Quote:
Public Declare Function GetAsyncKeyState Lib "user32" (ByVal vKey As Long) As Integer
Option Explicit
Public Declare Sub mouse_event Lib "user32" (ByVal dwFlags As Long, ByVal dx As Long, ByVal dy As Long, ByVal cButtons As Long, ByVal dwExtraInfo As Long)
Public Declare Function SetCursorPos Lib "user32" (ByVal X As Long, ByVal Y As Long) As Long
Public Declare Function GetCursorPos Lib "user32" (lpPoint As POINTAPI) As Long
Public Const MOUSEEVENTF_LEFTDOWN = &H2
Public Const MOUSEEVENTF_LEFTUP = &H4
Public Const MOUSEEVENTF_MIDDLEDOWN = &H20
Public Const MOUSEEVENTF_MIDDLEUP = &H40
Public Const MOUSEEVENTF_RIGHTDOWN = &H8
Public Const MOUSEEVENTF_RIGHTUP = &H10
Public Const MOUSEEVENTF_MOVE = &H1
Public Type POINTAPI
X As Long
Y As Long
End Type
Public Function GetCurrentX() As Long
Dim Position As POINTAPI
GetCursorPos Position
GetCurrentX = Position.X
End Function
Public Function GetCurrentY() As Long
Dim Position As POINTAPI
GetCursorPos Position
GetCurrentY = Position.Y
End Function
Public Sub LeftClick()
LeftDown
LeftUp
End Sub
Public Sub LeftDown()
mouse_event MOUSEEVENTF_LEFTDOWN, 0, 0, 0, 0
End Sub
Public Sub LeftUp()
mouse_event MOUSEEVENTF_LEFTUP, 0, 0, 0, 0
End Sub
Public Sub MiddleClick()
MiddleDown
MiddleUp
End Sub
Public Sub MiddleDown()
mouse_event MOUSEEVENTF_MIDDLEDOWN, 0, 0, 0, 0
End Sub
Public Sub MiddleUp()
mouse_event MOUSEEVENTF_MIDDLEUP, 0, 0, 0, 0
End Sub
Public Sub MoveMouse(xMove As Long, yMove As Long)
mouse_event MOUSEEVENTF_MOVE, xMove, yMove, 0, 0
End Sub
Public Sub RightClick()
RightDown
RightUp
End Sub
Public Sub RightDown()
mouse_event MOUSEEVENTF_RIGHTDOWN, 0, 0, 0, 0
End Sub
Public Sub RightUp()
mouse_event MOUSEEVENTF_RIGHTUP, 0, 0, 0, 0
End Sub
The mouse_event and SetCursorPos are used to control the mouse. GetCursorPos is used to return you the curent position of your mouse.
How to control the mouse? Lets say you want to move the cursol to pixel coordinates 500, 500 and click. You simply call...
Also see the other functions in the module... you can use any like midle click,right click ect. More about mouse control in next tutorials. Now lets return to our AutoScater.Quote:
MoveMouse 500, 500
LeftClick
On the main form add a timer and set its "Interval" value to 150. This will call the code under timer every 0.15 sec, In our case will autoclick if you hold the right button every 0.15 sec. I set it to so low because i dont know the minimum time between 2 scaters and I dont want to miss any 0.1 sec :D
Now under timer add this code:
Edit: not to confuse any1, the timer should be renamed to "timMain" or replace the "timMain" in the above code with "Timer1".Quote:
Private Sub timMain_Timer()
result = GetAsyncKeyState(vbKeyRButton) 'gets the state of the right mouse button
If result = -32768 Then 'if its down
RightUp 'release it
RightDown 'and return it down again untill you release it in reality
End If
End Sub
Now compile and vala... you have an AutoScater wich will constantly press righ mouse button whyle you hold it.
I hope this helped some people... More will come ;)