(c++ win32) Taking screenshot/reading all pixels onscreen?
Hi, I want to read all the pixels on screen (a screenshot), eg if I'm playing a movie it will capture the pixels, instead of showing black and capture whatever else apps I have onscreen.
So how would I go about it?
thx
To capture the screen (Win32) use CreateDC("DISPLAY",0,0,0) (and DeleteDC() when done)... and then either GetPixel() or GetDIBits().
You'll have to create memory DCs and Compatible Bitmaps if you go the GetDIBits() route.
You'll have to create memory DCs and Compatible Bitmaps if you go the GetDIBits() route.
The movie I am playing comes up as black, are there any solutions?
heres a screenshot that i took using that code:
heres the source:
thx
heres a screenshot that i took using that code:
heres the source:
HDC screen = CreateDC("DISPLAY", 0,0,0);HDC dest = CreateCompatibleDC(screen);RECT rect;GetWindowRect(GetDesktopWindow(), &rect); HBITMAP bmp = CreateCompatibleBitmap(screen, rect.right, rect.bottom);SelectObject(dest, bmp);BitBlt(dest, 0, 0, rect.right, rect.bottom, screen, 0, 0, SRCCOPY);CreateBMPFile(0, "pszFile.bmp", CreateBitmapInfoStruct(0, bmp), bmp, dest); DeleteDC(screen);
thx
you have to open two media player windows. First one grabs the hardware overlay (the black color you see).
The second one can't use the overlay, and so you can screenshot the image.
There might also be an option in your version of media player that allows you to disable harware acceleration/hw overlay.
The second one can't use the overlay, and so you can screenshot the image.
There might also be an option in your version of media player that allows you to disable harware acceleration/hw overlay.
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement