Chat LIVE With Programming Experts! There Are 23 Online Right Now...

Welcome to Dream.In.Code
Become a VB Expert!

Join 244,264 VB Programmers for FREE! Get instant access to thousands of VB experts, tutorials, code snippets, and more! There are 1,231 people online right now. Registration is fast and FREE... Join Now!




VB! coordinate the pixel and auto mouse click if the color is righ

 
Reply to this topicStart new topic

VB! coordinate the pixel and auto mouse click if the color is righ

not very smart in codes :(
14 Nov, 2008 - 06:24 AM
Post #1

New D.I.C Head
*

Joined: 9 Nov, 2008
Posts: 6

Hi!

I have a question!




So, I set the coordinate of pixel and color( wich start the mouse click ), the mouse must click on this pixel if the color is same of my choose

input:
I set coordinate of pixel x=200, y=300
and color RGB ( 60, 246, 80 )



if RGB color on that pixel is just like RGB color of my set then click that pixel if its not, go next...

How can I write this code? I try, but still have a problem with errors

my english is not very good, sorry

This post has been edited by not very smart in codes :(: 14 Nov, 2008 - 06:24 AM

User is offlineProfile CardPM
+Quote Post


n8wxs
RE: VB! Coordinate The Pixel And Auto Mouse Click If The Color Is Righ
14 Nov, 2008 - 07:50 PM
Post #2

--... ...-- -.. . -. ---.. .-- -..- ...
Group Icon

Joined: 6 Jan, 2008
Posts: 1,609



Thanked: 223 times
My Contributions
Please post your code using code.gif
User is offlineProfile CardPM
+Quote Post

not very smart in codes :(
RE: VB! Coordinate The Pixel And Auto Mouse Click If The Color Is Righ
15 Nov, 2008 - 09:25 AM
Post #3

New D.I.C Head
*

Joined: 9 Nov, 2008
Posts: 6

QUOTE(n8wxs @ 14 Nov, 2008 - 07:50 PM) *

Please post your code using code.gif




hmm, I have nothing yet, this is just idea crazy.gif

I´m totaly beginner in programing but have some maybe good ideas


I search the autoclicker and found this http://home.amis.net/crnkoma/ac.zip

it s very good, nice and easy for use, but I wanna have one function more....( color detector )

mouse pointer must recognize the color on pixel and click it, or not if color is wrong and I must/wanna set wich color is for click


I now, that is big jump for me, I must learn programing step by step, but mind always go forward too fast, and in the end, I am confused blink.gif
User is offlineProfile CardPM
+Quote Post

not very smart in codes :(
RE: VB! Coordinate The Pixel And Auto Mouse Click If The Color Is Righ
17 Nov, 2008 - 12:46 PM
Post #4

New D.I.C Head
*

Joined: 9 Nov, 2008
Posts: 6

QUOTE(n8wxs @ 14 Nov, 2008 - 07:50 PM) *

Please post your code using code.gif



CODE
Option Strict Off
Option Explicit On
Friend Class Form1
    Inherits System.Windows.Forms.Form
    'Beispiel : Mouseposition setzen.
    Private Declare Function GetPixel Lib "gdi32" (ByVal hdc As Long, ByVal lXPosition As Long, ByVal lYPosition As Long) As Long
    Private Declare Function GetCursorPos Lib "user32" (ByVal coll As Long) As Long
    Private Declare Function SetCursorPos Lib "user32" (ByVal X As Integer, ByVal Y As Integer) As Integer


    Private Sub fMousePositionSetzen(ByRef lXPosition As Integer, ByRef lYPosition As Integer)
        SetCursorPos(lXPosition, lYPosition)
    End Sub

    Private Sub Command1_Click(ByVal eventSender As System.Object, ByVal eventArgs As System.EventArgs) Handles Command1.Click
    
***RED section

        Dim Idc As Long
        Dim cursor As Integer
        Dim Icolor As Integer

***End RED section
      
        fMousePositionSetzen(CInt(Text1.Text), CInt(Text2.Text))

***RED section

                Call GetCursorPos(Cursor)
        Icolor = GetPixel(Idc, CInt(Text1.Text), CInt(Text2.Text))
        Label1 = Icolor

***End RED section

    End Sub

    Private Sub Command2_Click(ByVal eventSender As System.Object, ByVal eventArgs As System.EventArgs) Handles Command2.Click
        Me.Close()
    End Sub

    Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load

    End Sub

End Class




Like I say, I make a jump, not step by step blink.gif please don t laugh to my experiment crazy.gif

the terrible section I mark with ***RED section. So, I set the coordinate and mouse go there but I wanna now which color is on this coordinate, result I want in Label1, but....

This post has been edited by not very smart in codes :(: 17 Nov, 2008 - 12:55 PM
User is offlineProfile CardPM
+Quote Post

not very smart in codes :(
RE: VB! Coordinate The Pixel And Auto Mouse Click If The Color Is Righ
18 Nov, 2008 - 06:21 AM
Post #5

New D.I.C Head
*

Joined: 9 Nov, 2008
Posts: 6

Option Strict Off
Option Explicit On
Friend Class Form1
Inherits System.Windows.Forms.Form
'Beispiel : Mouseposition setzen.
Private Declare Function GetPixel Lib "gdi32" (ByVal hdc As Long, ByVal lXPosition As Long, ByVal lYPosition As Long) As Long
Private Declare Function GetCursorPos Lib "user32" (ByVal coll As Long) As Long
Private Declare Function SetCursorPos Lib "user32" (ByVal X As Integer, ByVal Y As Integer) As Integer

Private Sub fMousePositionSetzen(ByRef lXPosition As Integer, ByRef lYPosition As Integer)
SetCursorPos(lXPosition, lYPosition)
End Sub

Private Sub Command1_Click(ByVal eventSender As System.Object, ByVal eventArgs As System.EventArgs) Handles Command1.Click
fMousePositionSetzen(CInt(Text1.Text), CInt(Text2.Text))
Label1.Text = GetPixel(255, (CInt(Text1.Text)), CInt(Text2.Text))

End Sub
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load


End Sub

Private Sub Command2_Click(ByVal eventSender As System.Object, ByVal eventArgs As System.EventArgs) Handles Command2.Click
Me.Close()
End Sub


Private Sub Label2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Label2.Click

End Sub
End Class



In Label2 must display a RGB value of pixel, what I have to do?


This post has been edited by not very smart in codes :(: 18 Nov, 2008 - 10:14 AM
User is offlineProfile CardPM
+Quote Post

Fast ReplyReply to this topicStart new topic

Time is now: 7/4/09 12:21PM

Live VB Help!

Be Social

Dream.In.Code RSS Feed Dream.In.Code LinkedIn Group Follow Us On Twitter Fan Us On Facebook

VB Tutorials

Reference Sheets

VB Snippets

DIC Chatroom

Bye Bye Ads

Monthly Drawing

Thumb Drive

Top Contributors

Top 10 Kudos This Month