viewing and updating bitmaps
-
I've created an MDI application where when I open one dialog it shows a bitmap from my C:/ by:
void Image::showPicture(BYTE bfr[], DWORD size) { HBITMAP m_bitmap = NULL; CImage image; CJpeg2kDecoder imDec; image = imDec.Open(bfr, size); m_bitmap = (HBITMAP)image; m_nCam1img.SetBitmap(m_bitmap); if (m_bitmap) DeleteObject(m_bitmap);
However, when I open another dialog to do commanding (this dialog will partially cover the bitmap dialog) then go back to view my bitmap the portion of the bitmap dialog covered up by the commanding dialog is GONE! What do i need to do so that when I go back to view the bitmap dialog that the whole picture will still be displayed? Thanks!Kitty5
-
I've created an MDI application where when I open one dialog it shows a bitmap from my C:/ by:
void Image::showPicture(BYTE bfr[], DWORD size) { HBITMAP m_bitmap = NULL; CImage image; CJpeg2kDecoder imDec; image = imDec.Open(bfr, size); m_bitmap = (HBITMAP)image; m_nCam1img.SetBitmap(m_bitmap); if (m_bitmap) DeleteObject(m_bitmap);
However, when I open another dialog to do commanding (this dialog will partially cover the bitmap dialog) then go back to view my bitmap the portion of the bitmap dialog covered up by the commanding dialog is GONE! What do i need to do so that when I go back to view the bitmap dialog that the whole picture will still be displayed? Thanks!Kitty5
What is m_nCam1img ? You're deleting the bitmap, why, when it's in use ?
Christian Graus - C++ MVP 'Why don't we jump on a fad that hasn't already been widely discredited ?' - Dilbert
-
I've created an MDI application where when I open one dialog it shows a bitmap from my C:/ by:
void Image::showPicture(BYTE bfr[], DWORD size) { HBITMAP m_bitmap = NULL; CImage image; CJpeg2kDecoder imDec; image = imDec.Open(bfr, size); m_bitmap = (HBITMAP)image; m_nCam1img.SetBitmap(m_bitmap); if (m_bitmap) DeleteObject(m_bitmap);
However, when I open another dialog to do commanding (this dialog will partially cover the bitmap dialog) then go back to view my bitmap the portion of the bitmap dialog covered up by the commanding dialog is GONE! What do i need to do so that when I go back to view the bitmap dialog that the whole picture will still be displayed? Thanks!Kitty5
What happens if you delete this line if (m_bitmap) DeleteObject(m_bitmap);
WhiteSky
-
What is m_nCam1img ? You're deleting the bitmap, why, when it's in use ?
Christian Graus - C++ MVP 'Why don't we jump on a fad that hasn't already been widely discredited ?' - Dilbert
-
What happens if you delete this line if (m_bitmap) DeleteObject(m_bitmap);
WhiteSky
-
m_nCam1img is the variable for the picture control. the
if (m_bitmap) DeleteObject(m_bitmap);
I thought that that was what you needed to do. I did some research on how to view bmps and all the sample code had that....Kitty5
Try removing it. You do need to call it, but after you're not using the bitmap anymore. I don't think a picture control makes a copy.
Christian Graus - C++ MVP 'Why don't we jump on a fad that hasn't already been widely discredited ?' - Dilbert
-
I've created an MDI application where when I open one dialog it shows a bitmap from my C:/ by:
void Image::showPicture(BYTE bfr[], DWORD size) { HBITMAP m_bitmap = NULL; CImage image; CJpeg2kDecoder imDec; image = imDec.Open(bfr, size); m_bitmap = (HBITMAP)image; m_nCam1img.SetBitmap(m_bitmap); if (m_bitmap) DeleteObject(m_bitmap);
However, when I open another dialog to do commanding (this dialog will partially cover the bitmap dialog) then go back to view my bitmap the portion of the bitmap dialog covered up by the commanding dialog is GONE! What do i need to do so that when I go back to view the bitmap dialog that the whole picture will still be displayed? Thanks!Kitty5
Your CImage object goes out of scope at the end of the function so it probably destroys the HBITMAP via its destructor. Instead of m_bitmap = (HBITMAP)image; try m_bitmap = image.Detach(); and remove this line: if (m_bitmap) DeleteObject(m_bitmap); Mark