Please help! the way using SetBitmap, no memory leak?
-
when i use CStatic::SetBitmap, i don't know if memory leaks in my way. could u suggest me a good way out of leaking? Thank u very much! my way: CBitmap* pbmp = new CBitmap(); pbmp->LoadBitmap(someID); pstatic->SetBitmap(*pbmp); delete pbmp; //sometimes the line is ommitted Hello World!
-
when i use CStatic::SetBitmap, i don't know if memory leaks in my way. could u suggest me a good way out of leaking? Thank u very much! my way: CBitmap* pbmp = new CBitmap(); pbmp->LoadBitmap(someID); pstatic->SetBitmap(*pbmp); delete pbmp; //sometimes the line is ommitted Hello World!
if you allocate memory via new operator then you have to delete it via delete operator otherwise memory will be leaked in ur case delete pbmp would be done in OnDestroy pbmp should not be a local variable (define it in class) Live as if your were to die tomorrow. Learn as if you were to live forever. -Mahatma Gandhi
-
if you allocate memory via new operator then you have to delete it via delete operator otherwise memory will be leaked in ur case delete pbmp would be done in OnDestroy pbmp should not be a local variable (define it in class) Live as if your were to die tomorrow. Learn as if you were to live forever. -Mahatma Gandhi
-
if you allocate memory via new operator then you have to delete it via delete operator otherwise memory will be leaked in ur case delete pbmp would be done in OnDestroy pbmp should not be a local variable (define it in class) Live as if your were to die tomorrow. Learn as if you were to live forever. -Mahatma Gandhi
-
I See. Thank u! Please use your head again. if u have another good way, please tell me immediately. Hello World!
-
why are you using new ? in class do CBitmap bmp; in Constructor do - bmp.LoadBitmap(MY_BMP); then in OnInitDialog pic.SetBitmap(&bmp); Done! Live as if your were to die tomorrow. Learn as if you were to live forever. -Mahatma Gandhi