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. *** Dialog Box of Open & Save ******

*** Dialog Box of Open & Save ******

Scheduled Pinned Locked Moved C / C++ / MFC
tutorialquestionhelp
2 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.
  • S Offline
    S Offline
    Steve Lai
    wrote on last edited by
    #1

    Hi Everyone, How do I get the dialog box of Open & Save to come up?? (like the ones you see when you want to open and save a document in Microsoft Words). I tried using CFileDialog but I'm having trouble. I'm not sure if I'm putting the wrong things in the parameter or what. I also get this error message of "failed assertion". If anyone have any codes on an example of how to get the dialog box to work, please let me know. Thanks in Advance! Steve

    P 1 Reply Last reply
    0
    • S Steve Lai

      Hi Everyone, How do I get the dialog box of Open & Save to come up?? (like the ones you see when you want to open and save a document in Microsoft Words). I tried using CFileDialog but I'm having trouble. I'm not sure if I'm putting the wrong things in the parameter or what. I also get this error message of "failed assertion". If anyone have any codes on an example of how to get the dialog box to work, please let me know. Thanks in Advance! Steve

      P Offline
      P Offline
      Paolo Messina
      wrote on last edited by
      #2

      Hi Steve, That should be pretty simple:

      CString filename;
      CFileDialog opendlg(TRUE, NULL, NULL, OFN_HIDEREADONLY,
      _T("Text files|*.txt;*.doc|Images|*.bmp;*.gif||"));
      if (opendlg.DoModal() == IDOK)
      filename = opendlg.GetPathName()

      This code works for a single selection dialog. At the end you have the complete name of the selected file in the filename variable. This should help you getting started, but refer to MSDN for a complete explanation. Cheers, Paolo.

      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