A release to a function i've been working on to make a fishbot in VB. I'm releasing it and hopefully someone will find some use for it. It can be used for anything that involves scanning the screen.
It is customizable and is fast enough to scan 1.4 million pixels in .54 seconds.
So here it is.
The Function itself
Code:
Function PixelSearch(ByVal startX, ByVal startY, ByVal rangeX, ByVal rangeY, ByVal color)
Dim x As Integer
Dim y As Integer
Dim cur As Integer
Dim con As System.Drawing.Color
For x = startX To rangeX
For y = startY To rangeY
cur = API.GetPixel(ScreenDC, x, y)
con = ColorTranslator.FromOle(cur)
' Put your scan here
Next
Next
End Function
API.vb Code
Code:
Imports System
Imports System.Runtime.InteropServices
Friend Class API
<DllImport("User32.dll")> _
Public Shared Function GetCursorPos(ByRef pt As POINTAPI) As Integer
End Function
<StructLayout(LayoutKind.Sequential)> _
Public Structure POINTAPI
Public x As Integer
Public y As Integer
End Structure
<DllImport("Gdi32.dll")> _
Public Shared Function GetPixel(ByVal hdc As IntPtr, ByVal x As Integer, ByVal y As Integer) As Integer
End Function
<DllImport("Gdi32.dll")> _
Public Shared Function CreateDC(ByVal driverName As String, ByVal deviceName As String, ByVal output As String, ByVal lpInitData As IntPtr) As IntPtr
End Function
<DllImport("Gdi32.dll")> _
Public Shared Function DeleteDC(ByVal dc As IntPtr) As Boolean
End Function
End Class
To use the function use a string like the following
Code:
PixelSearch(0, 0, 1279, 1023, Colorhere)
The "Colorhere" is a specified color the function will look for. This can be compared by doing a simple scan against pixel colors to a predefined set.
You could also use a ARGB Set to compare against.
--
To scan, you must also call a CreateDC when the form opens.
You can do this by calling the following string.
Code:
ScreenDC = API.CreateDC("DISPLAY", Nothing, Nothing, CType(Nothing, IntPtr))
You must also delete the DC so when the form is closed put the following.
Code:
API.DeleteDC(ScreenDC)
If you have any questions, post them and I will answer what I can.
-Suicidity
-----)(Please leave the copyright text intact)(-----
This post is copyright by the user posting it and MMOwned.com - World of Warcraft Exploits,Hacks, Bots and Guides, where it was posted. You may not copy or reproduce this information on any other site without written permission from both the poster and MMOwned.com