Home > Software engineering >  After 20210309 Windows 10 update StretchBlt abnormal problem printing.
After 20210309 Windows 10 update StretchBlt abnormal problem printing.

Time:03-12

The CDC printDC;
CPrintDialog printDlg (FALSE);
DOCINFO DOCINFO;

If (printDlg DoModal ()==IDOK)
{
HDC HDC.
HDC=printDlg. GetPrinterDC ();
if (! PrintDC. Attach (hDC))
return;
}
The else
{
PrintDC. Detach ();
return;
}

PrintDC. SetMapMode (MM_LOMETRIC);

The CDC memDC;
CBitmap dispBmp, * oldBmp;
BITMAP bm.

HBITMAP HBITMAP=(HBITMAP) : : LoadImage (
: : GetModuleHandle (NULL),//module instance handle (to load images in other DLLS)
"D:/Mr Wang/My Practice/Test10 Test10/res/Ewm. BMP",//bitmap path
IMAGE_BITMAP,//bitmap type
0,//the specified image of wide
0, high//specified picture
LR_LOADFROMFILE | LR_CREATEDIBSECTION);

DispBmp. Attach (hBitmap);
DispBmp. GetBitmap (& amp; Bm);

MemDC. CreateCompatibleDC (& amp; PrintDC);
OldBmp=memDC. SelectObject (& amp; DispBmp);

Memset (& amp; DocInfo, 0, sizeof (docInfo));
DocInfo. CbSize=sizeof (docInfo);
DocInfo. LpszDocName="Window" Print;
If (printDC. StartDoc (& amp; DocInfo) & lt;=0)
{

PrintDC. Detach ();
return;
}
PrintDC. StartPage ();

PrintDC. StretchBlt (100-100, 160, 160, & amp; MemDC, 0, 0, bm bmWidth, bm. BmHeight, SRCCOPY);

MemDC. SelectObject (oldBmp);
MemDC. DeleteDC ();

PrintDC. EndPage ();
PrintDC. EndDoc ();

PrintDC. Detach ();

Paste the code directly,
Before the 0309 patches to print qr code is normal, after the update print up only a small point, Montana and test validation to help solve,

CodePudding user response:

StretchBlt has clearly coordinates in the help documents are logical coordinates
Bm. BmWidth, bm. BmHeight is pixel

  • Related