Home > Software engineering >  Help m_hBitmap!=0 problems
Help m_hBitmap!=0 problems

Time:09-19

Display image code below
CRect rect;
SubmitPicture. GetClientRect (& amp; The rect);
CImage image;
Image. The Load (the result - & gt; PIC);
The CDC * pDC=PrintPicture. GetWindowDC ();
Image. The Draw (pDC - & gt; M_hDC, the rect);

SetStretchBltMode (pDC - & gt; M_hDC, COLORONCOLOR);

The ReleaseDC (pDC);
Run here will error

CodePudding user response:

Assertion point here ATLASSUME (m_hBitmap!=NULL)

CodePudding user response:

CodePudding user response:

 
CRect rect;
SubmitPicture. GetClientRect (& amp; The rect);
CImage image;
Image. The Load (the result - & gt; PIC);
The CDC * pDC=PrintPicture. GetWindowDC ();
Image. The Draw (pDC - & gt; M_hDC, the rect);

SetStretchBltMode (pDC - & gt; M_hDC, COLORONCOLOR);

The ReleaseDC (pDC);

CodePudding user response:

Should be the images are not loading is successful, may be a routing problem

Should determine whether load success
If (image. The Load (the result - & gt; PIC)==S_OK)
{
Image. The Draw
}

Or
if(! Image. The IsNull ())
{
Image. The Draw
}

CodePudding user response:

The breakpoint look at the image is valid

CodePudding user response:

reference 4 floor zgl7903 response:
should be the images are not loading is successful, may be a routing problem

Should determine whether load success
If (image. The Load (the result - & gt; PIC)==S_OK)
{
Image. The Draw
}

Or
if(! Image. The IsNull ())
{
Image. The Draw
}

Why the path might be a problem?

CodePudding user response:

Thank you for your attention, the problem has been solved,
  • Related