If your child window is modeless, you can use the pointer to your dialog and use
#define UWM_CUSTOM (WM_APP+1)
void CMFCApplicationTestDlg::OnBnClickedButCreatedlg()
{
CString str = _T("Test");
CChildDlg* pChildDlg = new CChildDlg(this);
pChildDlg->Create(IDD_DIALOG_CHILD, this);
pChildDlg->ShowWindow(SW_SHOW);
pChildDlg->PostMessage(UWM_CUSTOM, (WPARAM)&str, 0);
}
If your child window is modal, you can't because after
DoModal()
returns, the dialog will already be destroyed.