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. Open a file explorer in a dialog based MFC app

Open a file explorer in a dialog based MFC app

Scheduled Pinned Locked Moved C / C++ / MFC
c++question
3 Posts 3 Posters 1 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.
  • T Offline
    T Offline
    tylerz1970
    wrote on last edited by
    #1

    Hi guys, I do need your suggestions. In document based MFC application, there is a menu item “ID_FILE_OPEN”. When you press it, it will run cWinApp::OnFileOpen. Now, I have a dialog based MFC application. I want to add a button to achieve above function. When I press the button, it can open a file explorer or file manager. By the way, this MFC application doesn’t have StdAfx files. What I should do?

    G A 2 Replies Last reply
    0
    • T tylerz1970

      Hi guys, I do need your suggestions. In document based MFC application, there is a menu item “ID_FILE_OPEN”. When you press it, it will run cWinApp::OnFileOpen. Now, I have a dialog based MFC application. I want to add a button to achieve above function. When I press the button, it can open a file explorer or file manager. By the way, this MFC application doesn’t have StdAfx files. What I should do?

      G Offline
      G Offline
      Gary Kirkham
      wrote on last edited by
      #2

      Add an event handler for the button click event. Then use the CFileDialog class to prompt the user to select a file to open. From here it depends on how you have the data saved (serialized). You will have to supply your own file reading function. You can use the CFile class to open and read the file data or the ansi fopen, fread functions. Gary Kirkham A working Program is one that has only unobserved bugs I thought I wanted a career, turns out I just wanted paychecks

      1 Reply Last reply
      0
      • T tylerz1970

        Hi guys, I do need your suggestions. In document based MFC application, there is a menu item “ID_FILE_OPEN”. When you press it, it will run cWinApp::OnFileOpen. Now, I have a dialog based MFC application. I want to add a button to achieve above function. When I press the button, it can open a file explorer or file manager. By the way, this MFC application doesn’t have StdAfx files. What I should do?

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

        allrighte... If I get it, you want a button that will do exactly as if you'd press file->open? Simple: create that button, then set its ID at ID_FILE_OPEN. It's that simple... again.. I hope I got it right.. HTH, Andrei.

        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