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
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?
- ...
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
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)
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?
Re: What to do with OnNewDocument
It will only depend on your implementation of these three steps.
Re: What to do with OnNewDocument
I had it implemented and will test it.
Thank you very much for the help
Jacob
Re: What to do with OnNewDocument
I had it implemented and will test it.
Thank you very much for the help
Jacob