What to do with OnNewDocument
CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 8 of 8

Thread: What to do with OnNewDocument

  1. #1
    Join Date
    Nov 2012
    Posts
    5

    Question What to do with OnNewDocument

    Hi,

    This may be a very newbie question.

    I got a program from somebody. He had its initialization to run his program but never bothered to save the data for later use. Now I wanted to add the New, Open, Save, and Close to it, so I add OnNewDocument ahead of his program. It crashed every time I ran it.

    Shall I include his initialization in the OnNewDocument? If I can not separate the initialization part from his code, e.g., they come in as dll, what shall do?

    Thanks in advance

    Jacob

  2. #2
    VictorN's Avatar
    VictorN is offline Super Moderator Power Poster
    Join Date
    Jan 2003
    Location
    Wallisellen (ZH), Switzerland
    Posts
    17,544

    Re: What to do with OnNewDocument

    You have to debug this program to see where and why it crashes.
    Besides, you didn't provide enough info about this projec tlike:
    • is it MFC?
    • is it MDI or SDI?
    • is the Doc/View architecture used?
    • what IDE are you using?
    • ...
    Victor Nijegorodov

  3. #3
    Join Date
    Nov 2012
    Posts
    5

    Re: What to do with OnNewDocument

    Victor,

    Thanks for reply. Sorry for missing information.

    It is MFC and MDI, and I use VC++ 6.0. I am not quite sure about the Doc/Vew architecture. I only know that it was based upon Spatial's ACIS+Hoops. The program I got allows me to drawing 3D models, but does not save/open files. That is why I am trying to add the document managing parts.

    Since I don't have much access to the source code of the original program, I used OnNewDocument to set up a new doc, followed with that code. I hoped that the code would automatically read from and write to the new doc. I am not sure about the approach, would an executable code would communicate with a doc without telling it about where and who the doc is.

    Jacob

  4. #4
    VictorN's Avatar
    VictorN is offline Super Moderator Power Poster
    Join Date
    Jan 2003
    Location
    Wallisellen (ZH), Switzerland
    Posts
    17,544

    Re: What to do with OnNewDocument

    OnNewDocument is called when you create a new document. So there is no any "read from". Just create an empty document.
    Well, you can then save trhis new created document. How would you save it depends only on you (well, maybe "somebody" has already implemented such a save)
    Victor Nijegorodov

  5. #5
    Join Date
    Nov 2012
    Posts
    5

    Re: What to do with OnNewDocument

    I will arrange the code in the following way:

    1. Use OnNewDocuemt to open a new doc;
    2. Run the program I got afterwards;
    3. Save it and see what is in it.

    Will I see any results or their are some issues?

  6. #6
    VictorN's Avatar
    VictorN is offline Super Moderator Power Poster
    Join Date
    Jan 2003
    Location
    Wallisellen (ZH), Switzerland
    Posts
    17,544

    Re: What to do with OnNewDocument

    It will only depend on your implementation of these three steps.
    Victor Nijegorodov

  7. #7
    Join Date
    Nov 2012
    Posts
    5

    Re: What to do with OnNewDocument

    I had it implemented and will test it.

    Thank you very much for the help

    Jacob

  8. #8
    Join Date
    Nov 2012
    Posts
    5

    Re: What to do with OnNewDocument

    I had it implemented and will test it.

    Thank you very much for the help

    Jacob

Posting Permissions

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


Windows Mobile Development Center


Click Here to Expand Forum to Full Width

This is a CodeGuru survey question.


Featured


HTML5 Development Center