Click to See Complete Forum and Search --> : Please explain ambiguity


Tom G
May 6th, 1999, 02:28 PM
I have stand-alone owner-draw button to use as "Close." MFC source file defines OnAppExit(): m_pMainWnd->SendMessage(WM_CLOSE). Even has comment stating: "Same as clicking close button in upper right corner." In my view class, define handler for button: AfxGetApp()->m_pMainWnd->SendMessage(WM_CLOSE). App closes fine. Here's problem: Memory leak when using owner-draw button. Among others, DocTemplate not deallocating. Using default "X" button, no leaks. Has me baffled. Any suggestions? Thanks.

Tom

Safai Ma
May 6th, 1999, 10:30 PM
Use PostMessage instead. It is safer as SendMessage acts much like a function call.

-Safai