Making bots/macros in VisualBasic 6.0

12/05/2006 03:10 inSertCoiN#1
[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.

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 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.
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...
Quote:
MoveMouse 500, 500
LeftClick
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.

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:
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
Edit: not to confuse any1, the timer should be renamed to "timMain" or replace the "timMain" in the above code with "Timer1".

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 ;)
12/05/2006 14:24 swords#2
Very nice man, thank you for contributing to epvp, but why go to all that coding if you can just simply do macro express or ghost mouse or make a quick code with autoit that does the same thing? :P

Btw is this in language C or is it just visual basics?
12/05/2006 15:17 inSertCoiN#3
Well the 1st module code is public code thet you can find on internet and its used to control mouse, get mouse output and keyboard output. When you create that module (just copy paste) you can use it for any next program you need to write.
So the only coding for this program is:
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
This takes only about 0.5 min work so its not so bad to make an own custom made AutoScater with so litle work. ;) + its only introduction so it will get more advanced and advanced.
For all the people who plan to use this: save the module. You will need it for other programs.

PS. Its a pure Visual Basic 6.0 code, you might have mestaken it because the function declarations are very simular in C++ as far as I know.
12/05/2006 16:25 ganoderma#4
Quote:
Originally posted by swords@Dec 5 2006, 14:24
Very nice man, thank you for contributing to epvp, but why go to all that coding if you can just simply do macro express or ghost mouse or make a quick code with autoit that does the same thing? :P

Btw is this in language C or is it just visual basics?
'Making bots/macros in VisualBasic 6.0'
(that is the topic name... I know but it has the answer in it xD)
12/05/2006 20:15 GhostRider#5
lol nice guide +k.. im trying to learn vb so this will help me alot
12/05/2006 20:20 kokoman#6
can i apply this on C++ turbo ?
12/05/2006 22:52 tasshu#7
xD hi insert its tesshu, *waves again* Another of my chars waved to u!

Dude i tried ur tutorial.. i cudnt get it right but im a dumbass anyway so i duno if this worked for others.. but next time cud u try a bit more detail? great tutorial tho man i tried for ages to make it work =\ guess i jus failed lol
12/06/2006 03:14 inSertCoiN#8
Quote:
Originally posted by kokoman+Dec 5 2006, 20:20--></span><table border='0' align='center' width='95%' cellpadding='3' cellspacing='1'><tr><td>QUOTE (kokoman @ Dec 5 2006, 20:20)</td></tr><tr><td id='QUOTE'>can i apply this on C++ turbo ?[/b]

all the functions in the module are windows functions that can be used by any programing language. I'm sorry but I dont know much about C++, i'm at the first "Hello World" lessons :D ... so the answer to your question is YES you can use the functions (GetAsyncKeyState, mouse_event, SetCursorPos, GetCursorPos) but i think that they should be declared litle diferent in C++, so the code needs changing.


Hi tasshu... ;)
*waves back*

<!--QuoteBegin--tasshu
@Dec 5 2006, 22:52
xD hi insert its tesshu, *waves again* Another of my chars waved to u!

Dude i tried ur tutorial.. i cudnt get it right but im a dumbass anyway so i duno if this worked for others.. but next time cud u try a bit more detail? great tutorial tho man i tried for ages to make it work =&#092; guess i jus failed lol
[/quote]
OK now...
1. Open new project.
2. in the meny go Project > New Module
3. Copy the 1st code from above (the long one) and paste it in to the module.
4. now go to the form and place a timer
5. set the Timer "interval" value to 150
6. enter this code in the main project
Quote:
Private Sub Timer1_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
7. save if you want and then compile

If you still cant get it but you need the AutoScater, you can download compiled version from above ;)
12/06/2006 17:00 tasshu#9
i tried lol jus cant, Im gna still try but this is getting me so angry >.< do u have a frm or summit i can load on visual basic so i can see how u coded it?

I tried yours.. loaded it up dont work mayby im missing sumit =&#092; im really noob. but i gave u K so nice, if u get more tutorials ill try em still
12/07/2006 02:11 tsu#10
Triumph..

InsertCoin
trixie
tesshu
ninja_shadow (?)
~vodka~

Right?
12/07/2006 02:23 inSertCoiN#11
Quote:
Originally posted by tasshu+Dec 6 2006, 17:00--></span><table border='0' align='center' width='95%' cellpadding='3' cellspacing='1'><tr><td>QUOTE (tasshu @ Dec 6 2006, 17:00)</td></tr><tr><td id='QUOTE'> i tried lol jus cant, Im gna still try but this is getting me so angry >.< do u have a frm or summit i can load on visual basic so i can see how u coded it?

I tried yours.. loaded it up dont work mayby im missing sumit =&#092; im really noob. but i gave u K so nice, if u get more tutorials ill try em still [/b]

OK i'll upload the source and put it in main post tomorow, its too late now ;)

...and you can't "load up" the AutoScater that you downloaded from above because its compiled program, finished version, final product, not a source code :D...


<!--QuoteBegin--tsu
@Dec 7 2006, 02:11
Triumph..

InsertCoin
trixie
tesshu
ninja_shadow (?)
~vodka~

Right?
[/quote]

I'm not gona play dumb and deny it, its true :D... But I deny that i'm using any hack/bot/macro from this forum, its only for educational reason... :D
12/07/2006 07:23 Bud_wis_er_420#12
I'm very interested too. I haven't really read this topic yet, just scanned it but I seen u are gona load some VB source code tomarrow. I been looking for this. Something that I can look at and figure out how things work and how to use VB to communicate with CO. If your willing, I could really use your help in the up coming days to learn how to make bots in VB. I use VB 2005 express. Dont know if that matters. But Im in the middle of learning it and its alot easier than I thought it would be. Good night to ya I'm going to bed too. lol
12/07/2006 16:51 inSertCoiN#13
Quote:
Originally posted by Bud_wis_er_420@Dec 7 2006, 07:23
I'm very interested too. I haven't really read this topic yet, just scanned it but I seen u are gona load some VB source code tomarrow. I been looking for this. Something that I can look at and figure out how things work and how to use VB to communicate with CO. If your willing, I could really use your help in the up coming days to learn how to make bots in VB. I use VB 2005 express. Dont know if that matters. But Im in the middle of learning it and its alot easier than I thought it would be. Good night to ya I'm going to bed too. lol
I'm not realy good at manipulating with CO memory, expecialy not DMA. I will only show you how to create macros and manipulating CO with pixel based coding (wich can be used to make pixel-based bot). Also I will show you how you can use some static CO memory data based on [Only registered and activated users can see links. Click Here To Register...].

VB 2005 express is lil diferent from VB 6.0 but you can find tutorials on the internet how to adapt the code.
Once again I would like to encourage all the VB coders out here to go publik with theyr work.

*source code uploaded*
12/07/2006 20:38 tasshu#14
Quote:
Originally posted by tsu@Dec 7 2006, 02:11
Triumph..

InsertCoin
trixie
tesshu
ninja_shadow (?)
~vodka~

Right?
and u r...? mr stalker? And vodka and trixie isnt me.. its my gf
12/07/2006 20:38 tasshu#15
Quote:
Originally posted by inSertCoiN+Dec 6 2006, 03:14--></span><table border='0' align='center' width='95%' cellpadding='3' cellspacing='1'><tr><td>QUOTE (inSertCoiN @ Dec 6 2006, 03:14)</td></tr><tr><td id='QUOTE'>
Quote:
Originally posted by -kokoman@Dec 5 2006, 20:20
can i apply this on C++ turbo ?
all the functions in the module are windows functions that can be used by any programing language. I'm sorry but I dont know much about C++, i'm at the first "Hello World" lessons :D ... so the answer to your question is YES you can use the functions (GetAsyncKeyState, mouse_event, SetCursorPos, GetCursorPos) but i think that they should be declared litle diferent in C++, so the code needs changing.


Hi tasshu... ;)
*waves back*

<!--QuoteBegin--tasshu
@Dec 5 2006, 22:52
xD hi insert its tesshu, *waves again* Another of my chars waved to u!

Dude i tried ur tutorial.. i cudnt get it right but im a dumbass anyway so i duno if this worked for others.. but next time cud u try a bit more detail? great tutorial tho man i tried for ages to make it work =&#092; guess i jus failed lol
OK now...
1. Open new project.
2. in the meny go Project > New Module
3. Copy the 1st code from above (the long one) and paste it in to the module.
4. now go to the form and place a timer
5. set the Timer "interval" value to 150
6. enter this code in the main project
Quote:
Private Sub Timer1_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
7. save if you want and then compile

If you still cant get it but you need the AutoScater, you can download compiled version from above ;) [/b][/quote]
thanks man ya a legend