Click here to Skip to main content
16,008,719 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: adding help to application Pin
David Crow9-Jul-04 7:03
David Crow9-Jul-04 7:03 
GeneralRe: adding help to application Pin
BlackDice9-Jul-04 7:11
BlackDice9-Jul-04 7:11 
Generalfullscreening a dialog Pin
locoone9-Jul-04 4:47
locoone9-Jul-04 4:47 
GeneralRe: fullscreening a dialog Pin
Timothy Grabrian9-Jul-04 6:02
professionalTimothy Grabrian9-Jul-04 6:02 
GeneralCPtrList Pin
Mahendra_7869-Jul-04 4:46
Mahendra_7869-Jul-04 4:46 
GeneralRe: CPtrList Pin
Navin9-Jul-04 5:10
Navin9-Jul-04 5:10 
GeneralRe: CPtrList Pin
Mahendra_7869-Jul-04 6:12
Mahendra_7869-Jul-04 6:12 
GeneralRe: CPtrList Pin
Gary R. Wheeler10-Jul-04 2:38
Gary R. Wheeler10-Jul-04 2:38 
One problem I see in your example is the line delete pPt;. This line won't work correctly. Since pPt is a void pointer, the compiler won't know which delete operator and destructor to call. This will lead to memory leaks and possibly heap corruption. A better approach would be:
while (!m_points.IsEmpty()) {
    MyType *pPt = (MyType *)m_points.RemoveHead();
    delete pPt;
}
In this case, MyType is the type of the value pointed to by members of the list.

If you use a CTypedPtrList<>, you can delete the contents of a list more simply as follows:
CTypedPtrList<MyType> m_points;
//...
while (!m_points.IsEmpty()) {
    delete m_points.RemoveHead();
}
Using CTypedPtrList you don't need type casts.


Software Zen: delete this;
GeneralListBox activex Pin
Peter Toss9-Jul-04 4:16
sussPeter Toss9-Jul-04 4:16 
GeneralRe: ListBox activex Pin
Jeffrey Walton14-Jul-04 12:59
Jeffrey Walton14-Jul-04 12:59 
GeneralSimulation:- Rings moving out from points with some delay &amp; store sim. to movie file Pin
JHAKAS9-Jul-04 4:04
JHAKAS9-Jul-04 4:04 
General&quot;calling&quot; a dialog box Pin
Keck9-Jul-04 4:04
Keck9-Jul-04 4:04 
GeneralRe: &quot;calling&quot; a dialog box Pin
David Crow9-Jul-04 4:57
David Crow9-Jul-04 4:57 
GeneralRe: &quot;calling&quot; a dialog box Pin
Maximilien9-Jul-04 5:36
Maximilien9-Jul-04 5:36 
Generalscript on this page .. Pin
Marian779-Jul-04 3:10
Marian779-Jul-04 3:10 
QuestionHow to Create SetUP of my Application Pin
Zeeshan Bilal9-Jul-04 1:39
Zeeshan Bilal9-Jul-04 1:39 
AnswerRe: How to Create SetUP of my Application Pin
palbano9-Jul-04 5:33
palbano9-Jul-04 5:33 
AnswerRe: How to Create SetUP of my Application Pin
valikac9-Jul-04 5:55
valikac9-Jul-04 5:55 
GeneralHOW: same menu - diffrent views Pin
JabraJabra9-Jul-04 1:23
JabraJabra9-Jul-04 1:23 
GeneralRe: HOW: same menu - diffrent views Pin
BlackDice9-Jul-04 6:18
BlackDice9-Jul-04 6:18 
GeneralDialog Disappear on pressing Escape key Pin
Zeeshan Bilal9-Jul-04 0:53
Zeeshan Bilal9-Jul-04 0:53 
GeneralRe: Dialog Disappear on pressing Escape key Pin
Johan Rosengren9-Jul-04 1:00
Johan Rosengren9-Jul-04 1:00 
GeneralRe: Dialog Disappear on pressing Escape key Pin
Zeeshan Bilal9-Jul-04 1:24
Zeeshan Bilal9-Jul-04 1:24 
Generali works But Now a Cross (close) Button in System Menu Not Works Pin
Zeeshan Bilal9-Jul-04 1:54
Zeeshan Bilal9-Jul-04 1:54 
GeneralRe: i works But Now a Cross (close) Button in System Menu Not Works Pin
Johan Rosengren9-Jul-04 4:01
Johan Rosengren9-Jul-04 4:01 

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.