Closing a dialog app window
-
I want to detect when a user closes a window by clicking on the X in the title bar. I dont know how to create a message map to catch the event. When I close the Window, I want to delete the CWnd object associated with that Window. :) Thanks. Jerry
-
I want to detect when a user closes a window by clicking on the X in the title bar. I dont know how to create a message map to catch the event. When I close the Window, I want to delete the CWnd object associated with that Window. :) Thanks. Jerry
Handle
WM_SYSCOMMAND
, specifically theSC_CLOSE
case. /ravi My new year's resolution: 2048 x 1536 Home | Articles | Freeware | Music ravib@ravib.com -
I want to detect when a user closes a window by clicking on the X in the title bar. I dont know how to create a message map to catch the event. When I close the Window, I want to delete the CWnd object associated with that Window. :) Thanks. Jerry
jerry1211a wrote: I want to detect when a user closes a window by clicking on the X in the title bar. Handle the
WM_CLOSE
message (CWnd::OnClose()
). jerry1211a wrote: When I close the Window, I want to delete the CWnd object associated with that Window. If you are doing this from the window that is being closed, then the proper place to do it is in thePostNcDestroy()
functionvoid CMyWindow::PostNcDestroy()
{
delete this;
}
"You're obviously a superstar." - Christian Graus about me - 12 Feb '03 "Obviously ??? You're definitely a superstar!!!" - mYkel - 21 Jun '04 "There's not enough blatant self-congratulatory backslapping in the world today..." - HumblePie - 21 Jun '05 Within you lies the power for good - Use it!