We've been dealing with an issue in our software ever since Microsoft released KB5000802/808 in early March. I've seen a similar post about it here, and the code we use is virtually the same (and hasn't changed in many years):
Calling Windows SelectObject in a printer-compatible device context returns NULL
In our case, we are actually printing OK, but our objects (bitmaps and text boxes) render invisibly on the screen (only "resize handles" appear) until we de-select and re-select the object. Rolling back the security update is a workaround but it's becoming more difficult to do this. We also have tested with Microsoft's hotfix KB5001649, but the issue persists. Has anyone else encountered this?
'''
hBitmap = (HBITMAP)LoadImage(NULL,szFileName,IMAGE_BITMAP,0,0,LR_CREATEDIBSECTION|LR_DEFAULTSIZE|LR_LOADFROMFILE|LR_VGACOLOR);
// [...]
HDC prn = GetPrinterDC(hwnd);
hdcMem = CreateCompatibleDC(prn);
HBITMAP hbmOld = (HBITMAP)SelectObject(hdcMem, hBitmap);
// hbmOld is NULL at this point, indicating SelectObject failure
'''