
TRY THIS AND YOU GET A MEMORY LEAK ???
Hi,
By sending a Quitmessage you dump the programm totally
without giving yourself any chance of cleanup. This is definitely the wrong way of terminating a program.
You should post either a WM_CLOSE message.
Quote:
>Hello,
>Try this :
> 1. Build an MFCApp using AppWizard in Visual Studio (6.0) (accept all
>defaults)
> 2. Map message WM_CHAR in the View
> 3. Implement as follows :
> void CMFCTestView::OnChar(UINT nChar, UINT nRepCnt, UINT nFlags)
> {
> switch (nChar)
> {
> case 27 : PostQuitMessage(0);
> return ;
> }
> CView::OnChar(nChar, nRepCnt, nFlags);
> }
> 4. Build and Run
> 5. Press escape (quits the application)
> 6. Watch the memory dump in the output window
> Is this to be expected or is there another way to quit an application
>without having
> this annoying memory leak ??
>Thanks.
>Chris
-----------------** -- Posted from CodeGuru -- **-----------------
http://www.codeguru.com/ The website for
Visual C++ programmers.