   comparing two pixels
  i've been using the gdi getpixel function to retrieve the colors of the pixels to compare them, i was wondering whether there may be faster ways of doing it   
  For very small numbers of pixels probably not. If you want to grab all the pixels in your window, you probably want to do something like create a HBITMAP using CreateCompatibleBitmap, select it into the device context and use GetDIBits. I'm not entirely sure if that will work, it's been a long time since I've done this and the MSDN documentation isn't completely clear - you might have to redraw your window after selecting the bitmap in for instance.   ;  If it where me, I would get the uncompressed data of the image and compare them manually.  GDI functions incure a pretty high overhead, and while good enough for general app building, I tend to stay away from them when performance is an issue.   ;  I dont want to use the GDI functions while capturing the screen shot. Any other method to use it like reading Screen Buffer. How can i do it in C/C++ ?   ;Quote:Original post by ebikhanI dont want to use the GDI functions while capturing the screen shot. Any other method to use it like reading Screen Buffer. How can i do it in C/C++ ?You can't do it just in C/C++.  You'd have to copy your rendering surface into an image and save it to disk using one whichever API you are using.  Seeing as how I don't know what APIs you're using, I'm affraid I can't get too much more specific than that.   ;  The OS will not let you directly read the screen buffer.  You have to go through one of the standard graphics API's - GDI, DirectX, or OpenGL.   ;  What exactly are you trying to do? It may make more sense to calculate for yourself what the "screen looks like" in an offscreen buffer (or if you're double-buffering or doing something else along those lines, just consult a buffer that you already have!) and compare values within an array of pixel data directly.   ;  Well my task is to capture screen shot of complete screen while my app will be running ... I dont want any performance issues ... so any method of dirtecly accessing the Screen Buffer ... I dont want to read not writing it ... So OS shud have no prob with it.   ;Quote:Original post by ZQJFor very small numbers of pixels probably not. If you want to grab all the pixels in your window, you probably want to do something like create a HBITMAP using CreateCompatibleBitmap, select it into the device context and use GetDIBits. I'm not entirely sure if that will work, it's been a long time since I've done this and the MSDN documentation isn't completely clear - you might have to redraw your window after selecting the bitmap in for instance.yeah, i asked because the amount of pixels i'll be comparing will be around 225000000-400000000... lol   