Click here to Skip to main content
15,868,027 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: All window handle from point Pin
Charles Oppermann30-Aug-11 10:42
Charles Oppermann30-Aug-11 10:42 
QuestionLoad and Display a Dialog Box from Simple Win32 DLL with No MFC support Pin
kamaljagesia25-Aug-11 21:33
kamaljagesia25-Aug-11 21:33 
QuestionRe: Load and Display a Dialog Box from Simple Win32 DLL with No MFC support Pin
CPallini25-Aug-11 21:55
mveCPallini25-Aug-11 21:55 
QuestionIs memory leak possible when I dont delete the object Pin
manoharbalu25-Aug-11 19:12
manoharbalu25-Aug-11 19:12 
AnswerRe: Is memory leak possible when I dont delete the object Pin
Eugen Podsypalnikov25-Aug-11 19:32
Eugen Podsypalnikov25-Aug-11 19:32 
AnswerRe: Is memory leak possible when I dont delete the object Pin
Stefan_Lang25-Aug-11 22:38
Stefan_Lang25-Aug-11 22:38 
GeneralRe: Is memory leak possible when I dont delete the object Pin
manoharbalu26-Aug-11 0:41
manoharbalu26-Aug-11 0:41 
GeneralRe: Is memory leak possible when I dont delete the object Pin
Stefan_Lang26-Aug-11 2:05
Stefan_Lang26-Aug-11 2:05 
If you create an object on the heap using new, then you must call delete on it at some point. So, to answer your question, the second option is correct. The first option will only remove the pointer from the list, making it inaccessible - but the object will still exist on the heap. Option 2 is not the only option though, and that is why I talked about the concept of 'owner' and suggested alternate ways.

Regarding the concept of 'ownership':
As a general rule, to minimize the risks of memory leaks or memory corruption, you should always make sure that each object created on the heap 'belongs' to some function or other object. What this means is, in case of a function 'owner', you make sure that at the end of that function you delete the created object; or, in case of another object, you call delete on the created object inside the destructor of the owner object.

By following this rule you will always be able to find the delete statement belonging to a new very quickly, and that way you can make sure it's not gone missing!
GeneralRe: Is memory leak possible when I dont delete the object Pin
manoharbalu26-Aug-11 2:33
manoharbalu26-Aug-11 2:33 
AnswerRe: Is memory leak possible when I dont delete the object Pin
richy_b28-Aug-11 10:27
richy_b28-Aug-11 10:27 
QuestionMFC's message map, no need of &? Pin
Dean Seo25-Aug-11 14:54
Dean Seo25-Aug-11 14:54 
AnswerRe: MFC's message map, no need of &? Pin
Peter_in_278025-Aug-11 17:22
professionalPeter_in_278025-Aug-11 17:22 
GeneralRe: MFC's message map, no need of &? Pin
Dean Seo25-Aug-11 18:16
Dean Seo25-Aug-11 18:16 
GeneralRe: MFC's message map, no need of &? Pin
Peter_in_278025-Aug-11 22:53
professionalPeter_in_278025-Aug-11 22:53 
GeneralRe: MFC's message map, no need of &? Pin
Albert Holguin26-Aug-11 5:03
professionalAlbert Holguin26-Aug-11 5:03 
SuggestionRe: MFC's message map, no need of &? [modified] Pin
Member 782758330-Aug-11 21:20
Member 782758330-Aug-11 21:20 
GeneralRe: MFC's message map, no need of &? Pin
Albert Holguin31-Aug-11 8:16
professionalAlbert Holguin31-Aug-11 8:16 
QuestionGetCharABCWidthsFloat returns different values on XP, Vista and Windows 7 Pin
transoft25-Aug-11 11:12
transoft25-Aug-11 11:12 
AnswerRe: GetCharABCWidthsFloat returns different values on XP, Vista and Windows 7 Pin
Code-o-mat25-Aug-11 23:52
Code-o-mat25-Aug-11 23:52 
GeneralRe: GetCharABCWidthsFloat returns different values on XP, Vista and Windows 7 Pin
transoft26-Aug-11 2:47
transoft26-Aug-11 2:47 
GeneralRe: GetCharABCWidthsFloat returns different values on XP, Vista and Windows 7 Pin
transoft26-Aug-11 2:50
transoft26-Aug-11 2:50 
GeneralRe: GetCharABCWidthsFloat returns different values on XP, Vista and Windows 7 Pin
Code-o-mat26-Aug-11 3:03
Code-o-mat26-Aug-11 3:03 
GeneralRe: GetCharABCWidthsFloat returns different values on XP, Vista and Windows 7 Pin
transoft26-Aug-11 4:16
transoft26-Aug-11 4:16 
QuestionRe: GetCharABCWidthsFloat returns different values on XP, Vista and Windows 7 Pin
MicroVirus26-Aug-11 6:00
MicroVirus26-Aug-11 6:00 
AnswerRe: GetCharABCWidthsFloat returns different values on XP, Vista and Windows 7 Pin
transoft26-Aug-11 6:11
transoft26-Aug-11 6:11 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.