Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. Creating a New Document

Creating a New Document

Scheduled Pinned Locked Moved C / C++ / MFC
c++question
3 Posts 3 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • J Offline
    J Offline
    Jerry Wang 0
    wrote on last edited by
    #1

    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!:)

    A R 2 Replies Last reply
    0
    • J Jerry Wang 0

      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!:)

      A Offline
      A Offline
      alex barylski
      wrote on last edited by
      #2

      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

      1 Reply Last reply
      0
      • J Jerry Wang 0

        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!:)

        R Offline
        R Offline
        Roger Allen
        wrote on last edited by
        #3

        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

        1 Reply Last reply
        0
        Reply
        • Reply as topic
        Log in to reply
        • Oldest to Newest
        • Newest to Oldest
        • Most Votes


        • Login

        • Don't have an account? Register

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • World
        • Users
        • Groups