我发现了这个:
HBITMAP MakePrintScreen()
{
HWND hWindow = GetDesktopWindow();
HDC hdcScreen = GetDC(hWindow);
RECT rect;
HBITMAP hbmC;
GetClientRect(hWindow,&rect);
if((hbmC = CreateCompatibleBitmap(hdcScreen,rect.right,rect.bottom)) != NULL)
{
HDC hdcC;
if((hdcC = CreateCompatibleDC(hdcScreen)) != NULL)
{
HBITMAP hbmOld = (HBITMAP)SelectObject(hdcC,hbmC);
BitBlt(hdcC,0,0,rect.right,rect.bottom,hdcScreen,0,0,SRCCOPY);
SelectObject(hdcC,hbmOld);
DeleteDC(hdcC);
}
}
ReleaseDC(hWindow,hdcScreen);
return hbmC;
}
从:
http://forum.4programmers.net/C_i_C++/149036-WINAPI_Print_screen_przyslonietego_okna