CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 12 of 12
  1. #1
    Join Date
    Sep 2009
    Posts
    5

    Exclamation A Coding Question

    Could someone please explain to me how to get a pixel's color. I want to change this into C++ code, please:

    If the color of this pixel is yellow
    Then click here.

    Thank you

  2. #2
    Join Date
    Feb 2009
    Location
    India
    Posts
    444

    Re: A Coding Question

    The GetPixel API will get you the pixel color.
    «_Superman
    I love work. It gives me something to do between weekends.

    Microsoft MVP (Visual C++)

  3. #3
    Join Date
    Mar 2003
    Location
    India {Mumbai};
    Posts
    3,871

    Re: A Coding Question

    Where in GUI or on text-based interface?
    My latest article: Explicating the new C++ standard (C++0x)

    Do rate the posts you find useful.

  4. #4
    Join Date
    Sep 2009
    Posts
    5

    Re: A Coding Question

    Sorry I am aware of the basics of coding, but not with all the termenology. When you say a GUI or text based interface, I'm not sure what it means... but I'm using Visual C++ Express Edition. And when you say getPixel i understand its a function but I don' t know what API means. I was hoping that you could just tpye in the coding for me so I look at it and understand it, please.

    Thank you.

  5. #5
    Join Date
    Mar 2003
    Location
    India {Mumbai};
    Posts
    3,871

    Re: A Coding Question

    How did you create the project?
    Does it contain 'main' function or 'WinMain' function?

    If it creates window (like this browser window), then it's GUI.
    If it creates console window (command prompt type), then it's text-base (CUI)
    My latest article: Explicating the new C++ standard (C++0x)

    Do rate the posts you find useful.

  6. #6
    Join Date
    Sep 2009
    Posts
    5

    Re: A Coding Question

    I believe I will be using GUI, but I haven't started it yet, I would just like to know how to get a Pixel's color.

  7. #7
    Join Date
    Mar 2003
    Location
    India {Mumbai};
    Posts
    3,871

    Re: A Coding Question

    I believe I will be using GUI, but I haven't started it yet, I would just like to know how to get a Pixel's color
    I am not concerned what you will be using. What are you using that interests me to answer your question appropriately.

    But I don't see you stand for using the API (whichever), to get or set the color.

    What your program does?
    My latest article: Explicating the new C++ standard (C++0x)

    Do rate the posts you find useful.

  8. #8
    Join Date
    Sep 2009
    Posts
    5

    Re: A Coding Question

    I'm not using a program right now. I'll be starting it once I understand how to get the pixel color. I just want to know how to get the pixel color using code in Visual C++ Express Edition. Is there a certain directory that I have to open up to get certain functions? Because I've learned how to do a mouse click just by surfing the web. Is this intensely difficult? or can it just be explained using a few lines of code?

  9. #9
    Lindley is offline Elite Member Power Poster
    Join Date
    Oct 2007
    Location
    Seattle, WA
    Posts
    10,895

    Re: A Coding Question

    Your question doesn't really make sense. That's why we're having trouble with it. Which window do you want to get a pixel from? If you don't have a program, then you can't have a window, so it doesn't really make sense to ask the question, now does it?

  10. #10
    Join Date
    Mar 2003
    Location
    India {Mumbai};
    Posts
    3,871

    Re: A Coding Question

    I'm not using a program right now. I'll be starting it once I understand how to get the pixel color. I just want to know how to get the pixel color using code in Visual C++ Express Edition
    Let me ask you one question:
    I want to know how to change from 5th gear to 4th gear, while riding/driving a vehicle. I will learn to drive vehicle only after I "know" how to change from 5th to 4th gear.
    Please help me, otherwise I cannot start learn driving.
    My latest article: Explicating the new C++ standard (C++0x)

    Do rate the posts you find useful.

  11. #11
    GCDEF is offline Elite Member Power Poster
    Join Date
    Nov 2003
    Location
    Florida
    Posts
    12,635

    Re: A Coding Question

    Quote Originally Posted by IanTheShaf View Post
    I'm not using a program right now. I'll be starting it once I understand how to get the pixel color. I just want to know how to get the pixel color using code in Visual C++ Express Edition. Is there a certain directory that I have to open up to get certain functions? Because I've learned how to do a mouse click just by surfing the web. Is this intensely difficult? or can it just be explained using a few lines of code?
    You've been given the answer already (at least based on the limited information provided). It seems like you're quite a long way from being able to understand or use it. If you don't know how to program, or how to use a Windows API, or even if you're using a GUI or not, what use is knowing how to get a pixel's color?

  12. #12
    Join Date
    Sep 2009
    Posts
    5

    Re: A Coding Question

    Sorry I don't know what I'm doing.
    But I just looked up how to do a left mouse click on C++, and I got a few lines, and they worked, then I studied them, and now I understand them. So I figured you guys would just be able to give me a few lines of code that would solve this. Didn't know it would be that big of a problem, sorry.
    I'll just wait until I get my degree in computer programming...

Tags for this Thread

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

Featured