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.

Recommended Answers

All 3 Replies

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

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.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.