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?
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.
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)