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. File dialog

File dialog

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

    I dont known how to use file dialog controls.Give me the example how to use the control.

    O A 2 Replies Last reply
    0
    • S sundar_mca

      I dont known how to use file dialog controls.Give me the example how to use the control.

      O Offline
      O Offline
      Owner drawn
      wrote on last edited by
      #2

      What control in the File dialog do you wish to use?


      Owner drawn Jesus Loves

      S 1 Reply Last reply
      0
      • S sundar_mca

        I dont known how to use file dialog controls.Give me the example how to use the control.

        A Offline
        A Offline
        Anilkumar K V
        wrote on last edited by
        #3

        U can use CFileDialog MFC class, just search google to find example of CFileDialog

        S 1 Reply Last reply
        0
        • O Owner drawn

          What control in the File dialog do you wish to use?


          Owner drawn Jesus Loves

          S Offline
          S Offline
          sundar_mca
          wrote on last edited by
          #4

          i wish to use open dialog control:((.so give me the code in api.please help me.

          O 2 Replies Last reply
          0
          • A Anilkumar K V

            U can use CFileDialog MFC class, just search google to find example of CFileDialog

            S Offline
            S Offline
            sundar_mca
            wrote on last edited by
            #5

            i wanted to use open dialog control in api.

            1 Reply Last reply
            0
            • S sundar_mca

              i wish to use open dialog control:((.so give me the code in api.please help me.

              O Offline
              O Offline
              Owner drawn
              wrote on last edited by
              #6

              There is no Open Dialog Control. But I guess you would like to use the CFileDialog class.

              CFileDialog cfd(TRUE);
              if(cfd.DoModal() == IDOK)
              	MessageBox(cfd.GetPathName());
              

              Owner drawn Jesus Loves

              1 Reply Last reply
              0
              • S sundar_mca

                i wish to use open dialog control:((.so give me the code in api.please help me.

                O Offline
                O Offline
                Owner drawn
                wrote on last edited by
                #7

                This is how we do it with OPENFILENAME: From MSDN:

                OPENFILENAME ofn;       // common dialog box structure
                char szFile[260];       // buffer for file name
                HWND hwnd;              // owner window
                HANDLE hf;              // file handle
                
                // Initialize OPENFILENAME
                ZeroMemory(&ofn, sizeof(ofn));
                ofn.lStructSize = sizeof(ofn);
                ofn.hwndOwner = hwnd;
                ofn.lpstrFile = szFile;
                //
                // Set lpstrFile[0] to '\0' so that GetOpenFileName does not 
                // use the contents of szFile to initialize itself.
                //
                ofn.lpstrFile[0] = '\0';
                ofn.nMaxFile = sizeof(szFile);
                ofn.lpstrFilter = "All\0*.*\0Text\0*.TXT\0";
                ofn.nFilterIndex = 1;
                ofn.lpstrFileTitle = NULL;
                ofn.nMaxFileTitle = 0;
                ofn.lpstrInitialDir = NULL;
                ofn.Flags = OFN_PATHMUSTEXIST | OFN_FILEMUSTEXIST;
                
                // Display the Open dialog box. 
                
                if (GetOpenFileName(&ofn)==TRUE) 
                    ::MessageBox(NULL, ofn.lpstrFile, "File Open", MB_OK);
                

                Owner drawn Jesus Loves

                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