OldSchoolHack

Register / Login English

color "triggerbot"

icon Thread: color "triggerbot"

Join Date: Jun 2010

Posts: 561

VB Code:
  1. Imports System.Runtime.InteropServices
  2.  
  3. Public Class Form1
  4.  
  5. Public pixColor As Color = GetPixelColor(Cursor.Position.X, Cursor.Position.Y)
  6. Public modelcolor As Color = GetPixelColor(Cursor.Position.X, Cursor.Position.Y)
  7. Public ForeColorStr As String
  8. Public model As String
  9.  
  10.  
  11.  
  12. <DllImport("gdi32.dll")> _
  13. Private Shared Function CreateDC( _
  14. ByVal lpszDriver As String, _
  15. ByVal lpszDevice As String, _
  16. ByVal lpszOutput As String, _
  17. ByVal lpInitData As IntPtr) As IntPtr
  18. End Function
  19.  
  20. <DllImport("gdi32.dll")> _
  21. Private Shared Function DeleteDC(ByVal hdc As IntPtr) As Boolean
  22. End Function
  23.  
  24. <DllImport("gdi32.dll")> _
  25. Private Shared Function GetPixel( _
  26. ByVal hdc As IntPtr, _
  27. ByVal nXPos As Integer, _
  28. ByVal nYPos As Integer) As Integer
  29. End Function
  30.  
  31. Public Function GetPixelColor(ByVal x As Integer, ByVal y As Integer) As Color
  32. Dim hdcScreen As IntPtr = CreateDC("Display", Nothing, Nothing, IntPtr.Zero)
  33. Dim colorRef As Integer = GetPixel(hdcScreen, x, y)
  34. DeleteDC(hdcScreen)
  35.  
  36. Return Color.FromArgb(colorRef And &HFF, _
  37. (colorRef And &HFF00) >> 8, (colorRef And &HFF0000) >> 16)
  38. End Function
  39.  
  40. Public Declare Sub mouse_event Lib "user32" Alias "mouse_event" (ByVal dwFlags As Long, ByVal dx As Long, ByVal dy As Long, ByVal cButtons As Long, ByVal dwExtraInfo As Long)
  41.  
  42. Public Const MOUSEEVENTF_LEFTDOWN = &H2
  43. Public Const MOUSEEVENTF_LEFTUP = &H4
  44.  
  45. Public Sub SimulateClick()
  46. mouse_event(MOUSEEVENTF_LEFTDOWN, 0, 0, 0, 0)
  47. mouse_event(MOUSEEVENTF_LEFTUP, 0, 0, 0, 0)
  48. End Sub
  49.  
  50.  
  51. Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick
  52.  
  53. 'Dim pixColor As Color = GetPixelColor(Cursor.Position.X, Cursor.Position.Y)
  54. 'Dim ForeColorStr As String = ColorTranslator.ToHtml(pixColor)
  55. 'Label1.Text = ForeColorStr
  56. Timer1.Enabled = False
  57. Timer2.Enabled = True
  58.  
  59.  
  60. End Sub
  61.  
  62. Public Declare Function GetAsyncKeyState Lib "user32.dll" (ByVal vKey As Int32) As UShort
  63.  
  64.  
  65.  
  66.  
  67.  
  68. Public Sub Timer2_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer2.Tick
  69.  
  70.  
  71. Dim modelcolor As Color = GetPixelColor(Cursor.Position.X, Cursor.Position.Y)
  72. Dim model As String = ColorTranslator.ToHtml(modelcolor)
  73. Label2.Text = model
  74. Timer4.Enabled = True
  75.  
  76.  
  77.  
  78.  
  79. End Sub
  80.  
  81. Private Sub Timer3_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer3.Tick
  82. If CBool(GetAsyncKeyState(Keys.F12)) Then
  83. Timer1.Enabled = True
  84. Dim pixColor As Color = GetPixelColor(Cursor.Position.X, Cursor.Position.Y)
  85. Dim ForeColorStr As String = ColorTranslator.ToHtml(pixColor)
  86. Label1.Text = ForeColorStr
  87.  
  88.  
  89.  
  90. ' Else : Timer1.Enabled = False
  91. 'Timer2.Enabled = False
  92. End If
  93. End Sub
  94.  
  95. Private Sub Timer4_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer4.Tick
  96.  
  97. If model <> ForeColorStr Then
  98. SimulateClick()
  99. Timer2.Enabled = False
  100. Timer4.Enabled = False
  101.  
  102. Else
  103.  
  104.  
  105.  
  106. End If
  107.  
  108.  
  109. End Sub
  110. End Class

habs mal kurz in die VB tags gesetzt, weil cihs so unübersichtlich fand


Achja ich würde das alles in ner Do Loop Schleife machen, ist deutlich schneller und übersichtlicher