Possible Duplicate:
how to make screen screenshot with win32 in c++?
I am currently trying to create an application that saved a portion of the screen to a bmp. I have found BitBlt but I really don’t know what to do with it. I have tried searching for some answers but I still haven’t found a clarifying one using C++.
So, basically I want this function:
bool capturePartScreen(int x, int y, int w int, h, string dest){
//Capture part of screen according to coordinates, width and height.
//Save that captured image as a bmp to dest.
//Return true if success, false if failure
}
BitBlt:
BOOL BitBlt(
__in HDC hdcDest,
__in int nXDest,
__in int nYDest,
//The three above are the ones I don't understand!
__in int nWidth,
__in int nHeight,
__in HDC hdcSrc,
__in int nXSrc,
__in int nYSrc,
__in DWORD dwRop
);
What should that hdc be and how do I obtain the bmp?
It took a while, but I have now finally ended up with a functioning script.
Requirements:
Also you might(?) have to add ole32, oleaut32 and uuid to your linker.
screenCapturePart:
saveBitmap: