J
John
I wrote a MDI application with a CRichEditView. When the user clicks on a
button the program displays a dialog box and after the user closes the
dialog box the program has to open a new document and then write a text
string in it. I wrote the following code to do that.
void CFormatPlannerView::OnPlaylistGenerate()
{
CGenerateDlg dlg;
if (dlg.DoModal() == IDOK)
{
CFormatPlannerApp* pApp= (CFormatPlannerApp*)AfxGetApp();
pApp->pDocTemplate->OpenDocumentFile(NULL);
GetRichEditCtrl().ReplaceSel("Test playlist\n");
}
}
I want the function to open a new document and then write the text string in
the new document but what happens is that the function opens a new document
(document2) and then writes the text string in document1 instead of
document2. Any suggestions on how to fix this?
Thanks in advance,
John.
button the program displays a dialog box and after the user closes the
dialog box the program has to open a new document and then write a text
string in it. I wrote the following code to do that.
void CFormatPlannerView::OnPlaylistGenerate()
{
CGenerateDlg dlg;
if (dlg.DoModal() == IDOK)
{
CFormatPlannerApp* pApp= (CFormatPlannerApp*)AfxGetApp();
pApp->pDocTemplate->OpenDocumentFile(NULL);
GetRichEditCtrl().ReplaceSel("Test playlist\n");
}
}
I want the function to open a new document and then write the text string in
the new document but what happens is that the function opens a new document
(document2) and then writes the text string in document1 instead of
document2. Any suggestions on how to fix this?
Thanks in advance,
John.