Click here to Skip to main content
15,907,225 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: Console to win app Pin
dr.eu11-Feb-04 3:12
dr.eu11-Feb-04 3:12 
GeneralRe: Console to win app Pin
jmkhael11-Feb-04 3:25
jmkhael11-Feb-04 3:25 
GeneralPDF Viewer Pin
Mahesh Varma11-Feb-04 2:32
Mahesh Varma11-Feb-04 2:32 
GeneralRe: PDF Viewer Pin
Joel Lucsy11-Feb-04 2:57
Joel Lucsy11-Feb-04 2:57 
GeneralHelp with memory leak warning message Pin
J.B.11-Feb-04 2:15
J.B.11-Feb-04 2:15 
GeneralRe: Help with memory leak warning message Pin
Antti Keskinen11-Feb-04 2:31
Antti Keskinen11-Feb-04 2:31 
GeneralRe: Help with memory leak warning message Pin
J.B.11-Feb-04 5:21
J.B.11-Feb-04 5:21 
GeneralRe: Help with memory leak warning message Pin
Antti Keskinen11-Feb-04 6:34
Antti Keskinen11-Feb-04 6:34 
Memory leaks can happen in MFC as well if you use it's routines incorrectly. In these cases, you must check through the MFC Reference in order to determine how a certain class is supposed to be used.

As for the memory blocks, put the definition flag and the include files into your stdafx.h file. This causes them to be included everywhere, and respectively, be effective everywhere. Then call the _CrtSetDbgFlag( _CRTDBG_ALLOC_MEM_DF | _CRTDBG_LEAK_CHECK_DF); on your application's InitInstance. This gives you the leak information always when your application exits.

Now place arbitary exit points into your application: during it's startup, after the initializations, during a normal run, at the exit phase and so on. This allows you to determine the position in where to look for the memory leaks.

An additional thing about using MFC: Remember that all it's classes are wrappers or containers for Win32 API routines/objects. This having said, always in your code when you create a bitmap, for example, you can, if you want, call the Delete* methods to safely destroy the underlying Windows object. Sometimes, the destructor of MFC's classes does not call this method, thus leaving the underlying object intact, and leading into a memory leak.

It is difficult to advise you any further without actually seeing the code, but that is unfortunately impossible.

-Antti Keskinen

----------------------------------------------
The definition of impossible is strictly dependant
on what we think is possible.
GeneralRe: Help with memory leak warning message (solved) Pin
J.B.11-Feb-04 17:11
J.B.11-Feb-04 17:11 
GeneralRe: Help with memory leak warning message (solved) Pin
Antti Keskinen11-Feb-04 18:41
Antti Keskinen11-Feb-04 18:41 
GeneralRe: Help with memory leak warning message (solved) Pin
J.B.12-Feb-04 6:04
J.B.12-Feb-04 6:04 
GeneralRe: Help with memory leak warning message Pin
Peter Weyzen11-Feb-04 7:42
Peter Weyzen11-Feb-04 7:42 
GeneralRe: Help with memory leak warning message Pin
Graham Bradshaw11-Feb-04 3:49
Graham Bradshaw11-Feb-04 3:49 
GeneralReading the USB port Pin
Demian Panello11-Feb-04 2:01
Demian Panello11-Feb-04 2:01 
GeneralRe: Reading the USB port Pin
Antti Keskinen11-Feb-04 2:35
Antti Keskinen11-Feb-04 2:35 
GeneralRe: Reading the USB port Pin
Demian Panello11-Feb-04 4:54
Demian Panello11-Feb-04 4:54 
Generaledk.h Pin
barzw11-Feb-04 1:08
barzw11-Feb-04 1:08 
GeneralRe: edk.h Pin
Michael P Butler11-Feb-04 1:18
Michael P Butler11-Feb-04 1:18 
Generalmachine code Pin
Anonymous11-Feb-04 0:53
Anonymous11-Feb-04 0:53 
GeneralRe: machine code Pin
Prakash Nadar11-Feb-04 1:04
Prakash Nadar11-Feb-04 1:04 
GeneralRe: machine code Pin
Anonymous11-Feb-04 1:13
Anonymous11-Feb-04 1:13 
GeneralRe: machine code Pin
jmkhael11-Feb-04 1:30
jmkhael11-Feb-04 1:30 
GeneralRe: machine code Pin
Anonymous11-Feb-04 1:37
Anonymous11-Feb-04 1:37 
GeneralRe: machine code Pin
jhwurmbach11-Feb-04 2:47
jhwurmbach11-Feb-04 2:47 
GeneralRe: machine code Pin
Antti Keskinen11-Feb-04 3:04
Antti Keskinen11-Feb-04 3:04 

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.