DOC:CDocTemplate::CreateNewFrame() Won't Make New CDocument (121321)
The information in this article applies to:
- The Microsoft Foundation Classes (MFC), when used with:
- Microsoft Visual C++ for Windows, 16-bit edition 1.0
- Microsoft Visual C++ for Windows, 16-bit edition 1.5
- Microsoft Visual C++ for Windows, 16-bit edition 1.51
- Microsoft Visual C++, 32-bit Editions 1.0
- Microsoft Visual C++, 32-bit Editions 2.0
This article was previously published under Q121321 SUMMARY
The Help File documentation for CDocTemplate::CreateNewFrame() says:
If the pDoc parameter is NULL, a new document will be created
if the appropriate runtime class is available; otherwise the
new view will be associated with the ...
This is not correct. Calling CreateNewFrame() with a NULL pDoc parameter
actually results in an assertion failure on the pDoc pointer and a TRACE()
statement in your output or debug window stating the following:
ASSERT_VALID fails with NULL pointer.
The reason for this is that CreateNewFrame() is not the appropriate
function to call when you don't have a pre-constructed CDocument-derived
object. The function to call is CMultiDocTemplate's or CSingleDocTemplate's
OpenDocumentFile(). The OpenDocumentFile() function creates a new CDocument
object by using CreateNewDocument().
Modification Type: | Major | Last Reviewed: | 12/1/2003 |
---|
Keywords: | kbdocfix KB121321 |
---|
|