Hi everyone,

I am trying to make an kinda autoclicker when the desired color is found.
I am using a class to make an screenshot of the screen.
VB Code:
  1. Public Class CaptureScreen
  2.     Private Declare Function CreateDC Lib "gdi32" Alias "CreateDCA" (ByVal lpDriverName As String, ByVal lpDeviceName As String, ByVal lpOutput As String, ByVal lpInitData As String) As Integer
  3.  
  4.     Private Declare Function CreateCompatibleDC Lib "GDI32" (ByVal hDC As Integer) As Integer
  5.  
  6.     Private Declare Function CreateCompatibleBitmap Lib "GDI32" (ByVal hDC As Integer, ByVal nWidth As Integer, ByVal nHeight As Integer) As Integer
  7.  
  8.     Private Declare Function GetDeviceCaps Lib "gdi32" Alias "GetDeviceCaps" (ByVal hdc As Integer, ByVal nIndex As Integer) As Integer
  9.  
  10.     Private Declare Function SelectObject Lib "GDI32" (ByVal hDC As Integer, ByVal hObject As Integer) As Integer
  11.  
  12.     Private Declare Function BitBlt Lib "GDI32" (ByVal srchDC As Integer, ByVal srcX As Integer, ByVal srcY As Integer, ByVal srcW As Integer, ByVal srcH As Integer, ByVal desthDC As Integer, ByVal destX As Integer, ByVal destY As Integer, ByVal op As Integer) As Integer
  13.  
  14.     Private Declare Function DeleteDC Lib "GDI32" (ByVal hDC As Integer) As Integer
  15.  
  16.     Private Declare Function DeleteObject Lib "GDI32" (ByVal hObj As Integer) As Integer
  17.  
  18.     Const SRCCOPY As Integer = &HCC0020
  19.  
  20.  
  21.  
  22.  
  23.     Public Shared Function GetScreen()
  24.         Dim oBackground As Bitmap
  25.         Dim FW, FH As Integer
  26.         Dim hSDC, hMDC As Integer
  27.         Dim hBMP, hBMPOld As Integer
  28.         Dim r As Integer
  29.  
  30.         hSDC = CreateDC("DISPLAY", "", "", "")
  31.         hMDC = CreateCompatibleDC(hSDC)
  32.  
  33.         FW = GetDeviceCaps(hSDC, 8)
  34.         FH = GetDeviceCaps(hSDC, 10)
  35.  
  36.         hBMP = CreateCompatibleBitmap(hSDC, FW, FH)
  37.  
  38.         hBMPOld = SelectObject(hMDC, hBMP)
  39.         r = BitBlt(hMDC, 0, 0, FW, FH, hSDC, 0, 0, 13369376)
  40.         hBMP = SelectObject(hMDC, hBMPOld)
  41.  
  42.         r = DeleteDC(hSDC)
  43.         r = DeleteDC(hMDC)
  44.  
  45.         oBackground = Image.FromHbitmap(New IntPtr(hBMP))
  46.         DeleteObject(hBMP)
  47.         Return oBackground
  48.     End Function
  49.  
  50. End Class
Credits go to Modderman.

Now I wanna make an functions that find the a pixel with the matching color I put in as RGB in 3 textboxes 1 for R etc.
How do I do this?

Already thanks,

Smurf