0

What I want to do is get my screen into a pixel array(array or rgb structs).

I got a program running that loads a .bmp and does this but I want to skip the manual printscreen and loading and get it straight into an array.

I searched a lot for this but I couldn't find anything this specific.

3
Contributors
3
Replies
5
Views
7 Years
Discussion Span
Last Post by Mephesh
0

http://msdn.microsoft.com/en-us/library/dd144871%28VS.85%29.aspx

That was amazingly simple. Thanks.

For anyone searching on google here's all you need to process the pixels on your screen:

COLORREF pixel = GetPixel( GetDC( NULL ), x, y ); 

cout<< (int)GetRValue( pixel );

//GetDC(NULL) is the full screen and x, y are the coordinates
//GetRValue(pixel) gets the red value of the pixel as a byte

Edited by Kesarion: n/a

0

GetDC() will return a device context from within its context. So within a CDialog class the method will return a CDC pointer that can be used to paint to the CDialog.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.