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. MFC: How to get name of file opened

MFC: How to get name of file opened

Scheduled Pinned Locked Moved C / C++ / MFC
questionc++tutorial
3 Posts 2 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.
  • A Offline
    A Offline
    ayca
    wrote on last edited by
    #1

    I have created a single document application with MFC wizard. I want to capture file name being opened when user selects a file and opens it through the file open dialog box. How can I do this? Thanks

    J 1 Reply Last reply
    0
    • A ayca

      I have created a single document application with MFC wizard. I want to capture file name being opened when user selects a file and opens it through the file open dialog box. How can I do this? Thanks

      J Offline
      J Offline
      Joe Woodbury
      wrote on last edited by
      #2

      CDocument::GetPathName() after document is opened You can override CDocument::OnOpenDocument() to do the open--I've done this many, many times. (I suggest overriding this, calling the base class, then stepping through the code to understand what the base class is doing [with dirty flags and all that.]) Anyone who thinks he has a better idea of what's good for people than people do is a swine. - P.J. O'Rourke

      A 1 Reply Last reply
      0
      • J Joe Woodbury

        CDocument::GetPathName() after document is opened You can override CDocument::OnOpenDocument() to do the open--I've done this many, many times. (I suggest overriding this, calling the base class, then stepping through the code to understand what the base class is doing [with dirty flags and all that.]) Anyone who thinks he has a better idea of what's good for people than people do is a swine. - P.J. O'Rourke

        A Offline
        A Offline
        ayca
        wrote on last edited by
        #3

        Thanks! It worked.

        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