By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
445,804 Members | 1,634 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 445,804 IT Pros & Developers. It's quick & easy.

Programmatically opening a new document and write a string in a CRichEditView.

P: n/a
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.
Jul 19 '05 #1
Share this Question
Share on Google+
1 Reply


P: n/a
"John" <jo********@hotmail.com> wrote...
I wrote a MDI application with a CRichEditView. When the user [...]
Any suggestions on how to fix this?


Nope. Please post MFC questions to an MFC newsgroup. I know
of two: comp.os.ms-windows.programmer.tools.mfc and
microsoft.public.vc.mfc. I bet you even are allowed to cross-
post in those. Here, OTOH, MFC is OT.

Victor
Jul 19 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.