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 :)
Printable View
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 :)
The GetPixel API will get you the pixel color.
Where in GUI or on text-based interface?
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.
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)
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.Quote:
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
But I don't see you stand for using the API (whichever), to get or set the color.
What your program does?
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?
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?
Let me ask you one question:Quote:
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
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. :D
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?
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...