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

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • John

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

    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 CFormatPlannerV iew::OnPlaylist Generate()
    {
    CGenerateDlg dlg;
    if (dlg.DoModal() == IDOK)
    {
    CFormatPlannerA pp* pApp= (CFormatPlanner App*)AfxGetApp( );
    pApp->pDocTemplate->OpenDocumentFi le(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.
  • Victor Bazarov

    #2
    Re: Programmaticall y opening a new document and write a string in a CRichEditView.

    "John" <john210360@hot mail.com> wrote...[color=blue]
    > I wrote a MDI application with a CRichEditView. When the user [...]
    > Any suggestions on how to fix this?[/color]

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

    Victor


    Comment

    Working...