Ok, after much pain and agony with a program that I am working on, I believe I have finally honed down the problem to something to do with the picture boxes. I am using this code to bring up a picture box.
m_sprite.Detach();
VERIFY(m_sprite.LoadBitmap(IDB_SOMEBITMAP_BITMAP));
m_picture1.SetBitmap(m_sprite);
(m_sprite being a CBitmap member of the dialog box, m_picture1 being a CStatic member of the picture box itself, and IDB_SOMEBITMAP_BITMAP being a bitmap that I have imported into resources.)
When I want change the bitmap in the picture box I simply follow the exact same code but swap the IDB_SOMEBITMAP_BITMAP with some other bitmap in my resources part of my program. Is this wrong? Something tells me that I need to clear out m_sprite first, but I thought I was doing that by using Detach(). Do I need to clear out the m_picture1 variable as well? If so how? Last question, is there anything wrong with this code that you can see at all? It works fine and dandy for a bit, but I use it time and time again in my coding and I believe it causes me to run out of memory. This is where I'm guessing my leak is. Any help at all is greatly appricated.
Thanks
Nyjil
m_sprite.Detach();
VERIFY(m_sprite.LoadBitmap(IDB_SOMEBITMAP_BITMAP));
m_picture1.SetBitmap(m_sprite);
(m_sprite being a CBitmap member of the dialog box, m_picture1 being a CStatic member of the picture box itself, and IDB_SOMEBITMAP_BITMAP being a bitmap that I have imported into resources.)
When I want change the bitmap in the picture box I simply follow the exact same code but swap the IDB_SOMEBITMAP_BITMAP with some other bitmap in my resources part of my program. Is this wrong? Something tells me that I need to clear out m_sprite first, but I thought I was doing that by using Detach(). Do I need to clear out the m_picture1 variable as well? If so how? Last question, is there anything wrong with this code that you can see at all? It works fine and dandy for a bit, but I use it time and time again in my coding and I believe it causes me to run out of memory. This is where I'm guessing my leak is. Any help at all is greatly appricated.
Thanks
Nyjil