Downscale bitmap screenshot of the screen

Viewed 47

I have a piece of code here which takes a "screenshot" of the display with HDC (with a high resolution aware program):

HDC hdc = GetDC(NULL);
HDC hDest = CreateCompatibleDC(hdc);

int width = GetSystemMetrics(SM_CXSCREEN);
int height = GetSystemMetrics(SM_CYSCREEN);

HBITMAP hbDesktop = CreateCompatibleBitmap( hdc, width, height);

SelectObject(hDest, hbDesktop);
BitBlt(hDest, 0,0, width, height, hdc, 0, 0, SRCCOPY);

Problem is, on higher resolutions displays such as mine (2736x1824), the bitmap image is very large coming in at around 14MB; and I certainly do not need that high of a resolution and would like to downscale it to a more reasonable size of around 1MB if possible as I want to send it over a TCP connection. I am very new to HDC so please cut me some slack. Thanks!

0 Answers
Related