I am taking screenshots of Windows desktop with code such as
HDC hScreen = GetDC(NULL);
HDC hDC = CreateCompatibleDC(hScreen);
HBITMAP hBitmap = CreateCompatibleBitmap(hScreen, w, h);
HGDIOBJ old_obj = SelectObject(hDC, hBitmap);
BOOL bRet = BitBlt(hDC, 0, 0, w, h, hScreen, x1, y1, SRCCOPY);
However Windows 10 has multiple desktops. Not only multiple screens like older Windows but desktop switching feature with CTRL+WIN+LEFT/RIGHT I would like to take screenshot of desktop 2 from application running in desktop 1, for instance. My guess is that I should give some parameter in
HDC hScreen = GetDC(NULL);
I googled but didn't find much examples. Any multiple desktop developers around?