Reputation: 1
Windows 11
I have three monitors in front of me. The one on the left has negative screen x coordinates, the centre one starts from zero and the one on the right, a 4K, carries on where the centre one left off. All nice and usual. So I execute
BitBlt(hMem2, 0, 0, bmWide, bmHigh, hdc, pt.x, pt.y, SRCCOPY | CAPTUREBLT);
BitBlt(hMem3, 0, 0, bmWide, bmHigh, hMem2, 0, 0, SRCCOPY);
BitBlt(hMem3, 0, 0, bmWide, bmHigh, hMem1, 0, 0, SRCINVERT);
BitBlt(hdc, pt.x, pt.y, bmWide, bmHigh, hMem3, 0, 0, SRCCOPY);
to read a block of screen (from hdc), add some overlay and write it back at POINT pt. Does it? Nope. It appears about 2000 pixels to the right. Consistently, no matter which monitor I put the test program on. The image painted is exactly what I want with all the screen background from where it came from so the first line is using pt correctly. It has my overlay. If it was landing in the right place it would all be wonderful.
All the hMems are loaded with a nice bitmap to hold the image.
I have tried setting
SetMapMode(hMem3, MM_TEXT);
to get 1 logical unit = 1 pixel on all of the HDCs.
I have experimented with versions of
SetThreadDpiAwarenessContext(DPI_AWARENESS_CONTEXT_PER_MONITOR_AWARE_V2);
but all to no avail. So I'm missing something. pt used as source is not the same as pt used as a destination.
Can anybody tell me where I'm going wrong?
Upvotes: 0
Views: 229