Creating a New Document
-
Hi, I have a MDI MFC application and I would like to tell it to create a new empty document (basically the same as going to File->New). Can anyone tell me what the function call is to do this? Thanks!:)
-
Hi, I have a MDI MFC application and I would like to tell it to create a new empty document (basically the same as going to File->New). Can anyone tell me what the function call is to do this? Thanks!:)
The Framework calls OnNewDocument() so unless calling this function directly asserts (I've never tried it) that should work. "An expert is someone who has made all the mistakes in his or her field" - Niels Bohr
-
Hi, I have a MDI MFC application and I would like to tell it to create a new empty document (basically the same as going to File->New). Can anyone tell me what the function call is to do this? Thanks!:)
If you can get a pointer to the document template you can call:
pDocTemplate->OpenDocumentFile(NULL) ; // create a new empty document
Doc templates can be got through the m_pDocManager pointer of the CWinApp object. You need to iterate it using a POSITION object. Or, if you have an existing document object of the type you want to create, you can call GetDocTemplate() on your document object to get a pointer to it. Roger Allen Sonork 100.10016 If I'm not breathing, I'm either dead or holding my breath. A fool jabbers, while a wise man listens. But is he so wise to listen to the fool? Please step to the rear of the car and make room for more victims. - John Simmons the Outlaw programmer, 1st Feb 2002, in the lounge