I have been created a tab control in dialog box (we called as Dialog Main). I add 3 frameless dialog box (we called as dialog A, Dialog B, Dialog C) in the tab control. The tab control working fine. I add three button (OK button, Cancel button ,Apply Button) in each frameless dialog box. However, when I clicked Cancel button in dialog A only dialog was closed. I want all dialogs(Dialog Main, dialog A, Dialog B, Dialog C) to be closed when I clicked OK of Cancel button inside each frameless dialog box(dialog A, Dialog B, Dialog C). Please anybody help me???

9 Years
Discussion Span
Last Post by cb02061

Why dont you override the OnOK and OnCancel functions.??
Then have a centralized closing function ( in the main dlg ) which calls all the close functions in each class.


Override the OnCalcel() method in the dialog. The below code works from any dialog box within the SDI or MDI program.

void CAboutDlg::OnCancel() 
    CWnd* pWin = AfxGetMainWnd();
    ::PostMessage(pWin->m_hWnd, WM_CLOSE,0,0);
This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.