I am trying to make a program that scans the pixels in the screen for certain colors and if it finds it sets the mouse location to that spot. Now i need your help to see if something like this is possible with vb and if it is possible point me into the right direction.

I don't have Visual Studio 2008 but I have Visual Studio 2005. In 2005 if you go to New Project then Other Project Types. You should see several setup projects including Setup Wizard.
Express editions do not have this feature. You have to use ClickOnce or copy all required files to the computer that has the correct Net version.

And how's that answer related to the question?

Here's something to try. This code is provided "AS IS" :twisted:

I created an invisible, full screen size form. With a timer control, I trigger the "search for the pixel" action

Private Sub Form1_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
  ' Create an invisible form with a timer control on it                                    
  Me.FormBorderStyle = Windows.Forms.FormBorderStyle.None                                  
  Me.WindowState = FormWindowState.Maximized                                               
  Me.Opacity = 0                                                                           
  '                                                                                        
  Timer1.Interval = 500                                                                    
  Timer1.Start()                                                                           
                                                                                           
End Sub

then I capture tick event and disable timer control

Private Sub Timer1_Tick(ByVal sender As Object, ByVal e As System.EventArgs) Handles Timer1.Tick
  ' Do scanning
  Dim x As Integer
  Dim y As Integer
  Dim ScreenX As Integer
  Dim ScreenY As Integer
  Dim g As Graphics
  Dim Img As Bitmap

  Timer1.Stop()
  ' Get screen size
  ScreenX = My.Computer.Screen.Bounds.Width
  ScreenY = My.Computer.Screen.Bounds.Height
  ' Create a bitmap of the screen
  g = Graphics.FromHwnd(Me.Handle)
  g.CopyFromScreen(0, 0, ScreenX - 1, ScreenY - 1, New Size(ScreenX, ScreenY))
  Img = New Bitmap(ScreenX, ScreenY, g)
  'Me.BringToFront()
  ' Loop the "screen"
  For x = 0 To ScreenX - 1
    For y = 0 To ScreenY - 1
      ' I searched for a hard-coded ARGB color (0, 0, 0, 0) i.e. black
      If Img.GetPixel(x, y) = Color.FromArgb(0, 0, 0, 0) Then
        ' Dispose graphics
        g.Dispose()
        ' Move the mouse
        Cursor.Position = New Point(x, y)
        ' Exit. 
        Exit Sub
      End If
    Next y
  Next x
  g.Dispose()

End Sub

Instead of simple exit, you may restart timer, change the color you're looking for etc.

This may be done in a simpler way and like I said, I don't guarantee that this works (in every situation).

Your question was titled "...Changing Pixel Color" but you asked for the code to move the mouse cursor.

Sorry about my answer I don't know what happened but I ment to put that in another thread. Again, Sorry.

It's ok, that happens :D

thanks to both of you for helping ;)

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.