Anyone else unable to print bitmaps on docs sent to a printer?

Henry, Shawn 11 Reputation points
2021-03-11T20:16:00.653+00:00

Is anyone else having trouble getting bitmaps to print on documents sent to a printer? I was working on some code yesterday, and it was working just fine. This morning however, it simply stopped working, without making any code changes (was continuing my validation testing). I went back to some older projects that use the same method for printing and now they aren't working either. I have about 5 or 6 applications which perform a similar print operation, and every one I've tested seems to no longer be working. I'm beginning to think something changed in the OS, as these applications which have been working reliably for years just stopped working today. Using CDC for printing, with a bitmap included as a resource in my project. Here's the code: CBitmap BmpCusomterLogo; CDC MemDC; // Load the bitmap from the resource BmpCusomterLogo.LoadBitmap( IDB_BITMAP1 ); // Create a memory device compatible with the above CPaintDC variable MemDC.CreateCompatibleDC( pDC ); // Select the new bitmap CBitmap *BmpPrevious = MemDC.SelectObject( &BmpCusomterLogo ); // Copy the bits from the memory DC into the current dc pDC->BitBlt(1480, 400, 1800, 364, &MemDC, 0, 0, SRCCOPY ); // Restore the old bitmap pDC->SelectObject( BmpPrevious );

Visual Studio
Visual Studio
A family of Microsoft suites of integrated development tools for building applications for Windows, the web and mobile devices.
4,578 questions
{count} votes

6 answers

Sort by: Most helpful
  1. Igor Delovski 6 Reputation points
    2021-03-13T15:44:11.257+00:00

    Seems like a Windows update ruined your code. SelectObject() fails here. Uninstall KB5000808 or KB5000802. Since most applications print their images just fine, I wonder how on earth everybody sends images to the printer?

    1 person found this answer helpful.

  2. Dylan Zhu-MSFT 6,406 Reputation points
    2021-03-12T02:28:17.17+00:00

    Hi HenryShawn,

    You can try to delete the .obj and .vs folders, then try to re-build your project.

    Best Regards, Dylan

    If the answer is helpful, please click "Accept Answer" and upvote it.
    Note: Please follow the steps in our * *documentation* to enable e-mail notifications if you want to receive the related email notification for this thread.**

    0 comments No comments

  3. krcma96 1 Reputation point
    2021-03-16T19:22:11.387+00:00

    I have the same problem, thought something was wrong with the printer drivers after the update but then I tried printing to pdf and the same problem was happening.
    I also tried running the same exe on a machine that wasn't updated and there it worked fine, the winspool.dll might be messed up or there is an OS level problem.

    0 comments No comments

  4. Esch, Bart van 1 Reputation point
    2021-04-09T19:06:44.88+00:00
    0 comments No comments

  5. krcma96 1 Reputation point
    2021-04-09T21:42:23.583+00:00

    It seems to be working now for me, I'm not sure which windows update fixed it works fine now.

    0 comments No comments