Hi I have an MFC DLL thats called by another application. When I hit Alt-F4 on the parent window, it closes itself and my MFC DLL application as well. I have been trying to implement the same from my MFC DLL application as well. i.e. When I hit Alt+F4 from my MFC DLL app, it should close itself and the calling application as well. I've tried the following in the OnClose message handler of the MFC DLL application: 1. DestroyWindow(GetParent()->m_hWnd); 2. DestroyWindow(AfxGetMainWnd()->GetParent()->m_hWnd); 3. DestroyWindow(AfxGetMainWnd()->m_hWnd); 4. PostMessage(AfxGetMainWnd()->m_hWnd, WM_SYSCOMMAND, SC_CLOSE, NULL); However, none of them seems to be working: When I hit Alt+F4, the MFC DLL application closes followed by a crash message from Windows. A quick reply would help immensely. Thanks.