Results 1 to 7 of 7

Thread: detecting pixel colors

  1. #1

    Thread Starter
    Junior Member
    Join Date
    Jul 2005
    Posts
    27

    detecting pixel colors

    I haven't learned vb yet, because I don't want to spend the $100+ on the software if I won't end up being able to make a program that does what I want it to do. I posted a couple months ago with a similar question, and the response was basically that it would be rather complicated to do what I want to do. But I have thought of a way to make things much more simple for me, if I make a program.

    My question is, if I learned vb, would it be a complicated or somewhat basic task to make a program that could detect the color of a specific pixel on my monitor, and react to it if it's the right color? The pixel wouldn't be showing up on the program I make, but on a webpage.

  2. #2
    I'm about to be a PowerPoster!
    Join Date
    Jan 2005
    Location
    Everywhere
    Posts
    13,647

    Re: detecting a pixels color

    Fairly simple:
    1. Use FindWindow() to get the handle of the web browser;
    2. Use FindWindowEx() to get the handle of the webpage rendering control (depends on the browser);
    3. GetDC() to get a handle to the DC of the control;
    4. GetPixel() to get the pixel colour;
    5. ReleaseDC to release the DC handle.


    I don't know where you're gonna find VB6 these days though, good luck.

  3. #3
    Frenzied Member Devion's Avatar
    Join Date
    Sep 2000
    Location
    The Netherlands
    Posts
    1,049

    Re: detecting a pixels color

    You can find VB6 almost everywhere, Ebay even and it might be cheaper at auctions then in the store. (Though I'm not sure MS EULA actually allows selling of owned products due to sharing of keys)

    Anyway; What penagate says is the fastest way, the findwindow functions might not be necessary if it's a foregroundwindow (you can get the handle for that).

  4. #4

    Thread Starter
    Junior Member
    Join Date
    Jul 2005
    Posts
    27

    thanks

    Thank you. That sounds very simple. I will try to get vb6 on ebay. I looked at a few auctions and they were $100-$175. Would it be worth saving some money to get vb5? (assuming I could find it). Or should spend a bit more for 6?

  5. #5
    PowerPoster
    Join Date
    Dec 2003
    Posts
    4,787

    Re: thanks

    Quote Originally Posted by ship
    Thank you. That sounds very simple. I will try to get vb6 on ebay. I looked at a few auctions and they were $100-$175. Would it be worth saving some money to get vb5? (assuming I could find it). Or should spend a bit more for 6?

    Dont go back to 5 it would make no sence IMO, if anythign you should be looking at moving to the dark side (Vb .Net)

    Pino

  6. #6
    Frenzied Member Devion's Avatar
    Join Date
    Sep 2000
    Location
    The Netherlands
    Posts
    1,049

    Re: thanks

    As if a thousand VB VM's cried out loud and got suddenly silenced.

  7. #7
    I'm about to be a PowerPoster! Hack's Avatar
    Join Date
    Aug 2001
    Location
    Searching for mendhak
    Posts
    58,333

    Re: thanks

    ship: I moved your post, and Pino's over here as they are relevant to the topic (although I'm not sure what this has to do with Pixel colors).

    I'm going to delete the other thread you started.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width