I resolved this a while ago. The way I was trying to use the lprcMonitor, but ended up using the dwData to fix it, as commented below:
gHdc = BeginPaint(hwnd, &gPaintStruct); EnumDisplayMonitors(gHdc, NULL, MonitorNumProcPaint, (LPARAM)&gHdc);
EndPaint(hwnd, &gPaintStruct);
BOOL PaintNonPrimaryDisplay(HMONITOR hMonitor, LPRECT lprcMonitor, LPARAM dwData)
{
HDC *pdc = (HDC*)dwData;
HDC hdcMem = CreateCompatibleDC(*pdc);
HBITMAP hbmMem = CreateCompatibleBitmap(*pdc, lprcMonitor->right - lprcMonitor->left, lprcMonitor->bottom - lprcMonitor->top);
HGDIOBJ hOld = SelectObject(hdcMem, hbmMem);
Gdiplus::Graphics *gpGraphics = Gdiplus::Graphics::FromHDC(hdcMem);
if (gpGraphics == NULL)
return false;
if (gpBitmapMotivations[1])
{
gpGraphics->DrawImage(gpBitmapMotivations[1], 0, 0, lprcMonitor->right - lprcMonitor->left, lprcMonitor->bottom - lprcMonitor->top);
}
DrawOverlay(0, 0, lprcMonitor->right - lprcMonitor->left, lprcMonitor->bottom - lprcMonitor->top, gpGraphics);
BitBlt(*pdc, lprcMonitor->left, lprcMonitor->top, lprcMonitor->right - lprcMonitor->left, lprcMonitor->bottom - lprcMonitor->top, hdcMem, 0, 0, SRCCOPY);
delete gpGraphics;
SelectObject(hdcMem, hOld);
DeleteObject(hbmMem);
DeleteDC(hdcMem);
return TRUE;
}