Using PrintWindow to capture screen or to take snapshot of a window!

PrintWindow is a cool function which helps us in printing a windows contents to a DC. Normal usage will be that we pass a printer DC, but here we pass a custom DC with a bitmap selected into this DC. Internally PrintWindow uses WM_PRINT and WM_PRINTCLIENT(This is my assumption). Here is a simple function which […]
Continue reading…

 

How to get color of a pixel from any Bitmap?

It’s easy to get color of a pixel from a bitmap. Here is a function which does this… [sourcecode language=’cpp’]#include #include // Returns Pixel color from bitmap COLORREF GetPixelValueFromBitmap( const int x, const int y, CBitmap& bmp ) { // DC for desktop CDC dcDesktop; dcDesktop.Attach( ::GetDC( GetDesktopWindow() )); // Create a DC compatible with […]
Continue reading…