Click to See Complete Forum and Search --> : Creating a new document


Azknom
August 26th, 1999, 11:56 AM
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

jtwine
August 26th, 1999, 01:52 PM
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.

Oleg Lobach
August 30th, 1999, 03:19 AM
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.