Loading Bitmaps More than once - Programmer
This is a discussion on Loading Bitmaps More than once - Programmer ; I have a picture control that displays various bitmaps throughout my
program. The following code wotks the first time through, but not
after that:
VERIFY(m_bmp.LoadBitmap(IDB_CARD));
m_card_1.SetBitmap(m_bmp);
Do I have to destroy and re-define m_bmp? I tried to, but maybe I
...
-
Loading Bitmaps More than once
I have a picture control that displays various bitmaps throughout my
program. The following code wotks the first time through, but not
after that:
VERIFY(m_bmp.LoadBitmap(IDB_CARD));
m_card_1.SetBitmap(m_bmp);
Do I have to destroy and re-define m_bmp? I tried to, but maybe I
don't have the right format, as it didn't work. I've looked
everywhere but can find no answer.
Thanks,
Matt
-
Re: Loading Bitmaps More than once
"matt" skrev i en meddelelse
news:c2838b8f.0402141053.375357dd@posting.google.c om...
> I have a picture control that displays various bitmaps throughout my
> program. The following code wotks the first time through, but not
> after that:
>
> VERIFY(m_bmp.LoadBitmap(IDB_CARD));
> m_card_1.SetBitmap(m_bmp);
>
> Do I have to destroy and re-define m_bmp? I tried to, but maybe I
> don't have the right format, as it didn't work. I've looked
> everywhere but can find no answer.
>
> Thanks,
>
> Matt
Did you try to call m_bmp.Detach() before reloading a new bitmap?
--
Bjarne Nielsen
-
Re: Loading Bitmaps More than once
"Bjarne Nielsen" wrote in message
news:40307dc2$0$265$edfadb0f@dread12.news.tele.dk. ..
> "matt" skrev i en meddelelse
> news:c2838b8f.0402141053.375357dd@posting.google.c om...
> > I have a picture control that displays various bitmaps throughout my
> > program. The following code wotks the first time through, but not
> > after that:
> >
> > VERIFY(m_bmp.LoadBitmap(IDB_CARD));
> > m_card_1.SetBitmap(m_bmp);
> >
> > Do I have to destroy and re-define m_bmp? I tried to, but maybe I
> > don't have the right format, as it didn't work. I've looked
> > everywhere but can find no answer.
> >
> > Thanks,
> >
> > Matt
>
> Did you try to call m_bmp.Detach() before reloading a new bitmap?
>
> --
> Bjarne Nielsen
>
Use DeleteObject rather than Detach. If you Detach without freeing the
handle, you'll get resource leaks.
Jae