Är det någon som vet om man kan göra om nedanstående kod så att den bara tar en skärmdump på det aktiva fönstret??? Coden är i C#Bra Fråga!!
// Create a normal DC and a memory DC for the entire screen. The
// normal DC provides a "snapshot" of the screen contents. The
// memory DC keeps a copy of this "snapshot" in the associated
// bitmap.
hdcScreen = CreateDC("DISPLAY", NULL, NULL, NULL);
hdcCompatible = CreateCompatibleDC(hdcScreen);
// Create a compatible bitmap for hdcScreen.
hbmScreen = CreateCompatibleBitmap(hdcScreen,
GetDeviceCaps(hdcScreen, HORZRES),
GetDeviceCaps(hdcScreen, VERTRES));
if (hbmScreen == 0)
errhandler("hbmScreen", hwnd);
// Select the bitmaps into the compatible DC.
if (!SelectObject(hdcCompatible, hbmScreen))
errhandler("Compatible Bitmap Selection", hwnd);
// Hide the application window.
ShowWindow(hwnd, SW_HIDE);
//Copy color data for the entire display into a
//bitmap that is selected into a compatible DC.
if (!BitBlt(hdcCompatible,
0,0,
bmp.bmWidth, bmp.bmHeight,
hdcScreen,
0,0,
SRCCOPY))
errhandler("Screen to Compat Blt Failed", hwnd);
// Redraw the application window.
ShowWindow(hwnd, SW_SHOW);