I have a custom dialog message box that pops-up when a edit control in my main dialog has wrong data.
CDlgError dlgError = new CDlgError(this);
dlgError.Create(CDlgError::IDD, this);
dlgError.m_staticMessage.SetWindowTextA("Error message!");
dlgError.ShowWindow(SW_SHOW);
//more code
I want the rest of the code to be executed only after i press an OK button in my CDlgError pop-up dialog. How can i do that?
Use
DoModalinstead ofCreateandShowWindowto show your error dialog. e.g.As you can see from the code you’ll need to pass in the text and THEN set your message label inside
CDlgError::OnInitDialogbecause the control won’t be initialized before going modal.