I'm an admittedly green programmer - but I am just playing with a program and I want to add the capability for the program to be able to read the RGB color value of a pixel at a certain location of the screen, and put it in a variable I can work with.
I know that will require some work with a Windows API/SDK - but any help or ideas you can provide would be great. I really have no idea how to go about this.
Oh, and I only have experience in C, and minimal experience at that.
not sure, but something like this should work:
COLORREF color = GetPixel( GetDC( HWND_DESKTOP ), x, y );
Thanks - Another Error
I tried that - and got this error:
"undefinted reference to '_GetPixel@12'
collect2: ld returned 1 exit status"
Any thoughts? Thanks.
And did you link with gdi32.lib?
I thought I did, but then again I'm not really sure I did it right. Like I said I have very minimal experience, and to be honest this is well over my head - but I know that if I can just get this to work I can handle the rest of the program.
On the basis that "ld" makes me think of gcc, I'm guessing you're either using Code::Blocks or Dev-C++. Depending which you have determines how you add the flag, but you'll need to go somewhere in options and add it in.
Then under the assumption you're using a project, you should do Alt-P for project options, and then go to parameters, and where it says linker add "-lgdi32".