CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 3 of 3
  1. #1
    Join Date
    Aug 1999
    Location
    Luleå, Sweden
    Posts
    2

    Creating a new document

    Hi

    I have an MDI in which I have a menu item that opens up a dialog box. In this dialog box some information is entered and I want this information to be displayed in a new document. As it is now I can do all of this except for opening the new document window. Is it possible to open a new document window from the dialog box and then display the information in this document?

    Urban


  2. #2
    Join Date
    Aug 1999
    Posts
    24

    Re: Creating a new document

    A Quick and dirty way is to set a flag someplace, store the data someplace, and trigger OnFileNew(). When the new view constructs, have it check the flag, and if the flag is set, have it get the stored data, use it, and then unset the flag.

    -=- James.
    -=- James.

  3. #3
    Join Date
    Jul 1999
    Location
    Moscow, Russia
    Posts
    667

    Re: Creating a new document

    1.Send WM_COMMAND (ID_FILE_NEW)to MDIFrameWnd.
    2. Send WM_COPYDATA with string to MDIFrameWnd.
    3.In MDIFrameWnd repost this message to all ChildFrames.
    4.In the Doc class I suppose you have to have CString member to hold string from dialog,which should be empty.
    5.In Your ChildFrame class enter handle for WM_COPYDATA,which should test if the relevant Doc class has empty string member - and if it has - set it to new (received with message).
    6.View will output the string from relevant Doc,in usual way(using TextOut for instance).

    Good luck,

    Oleg.


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured