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. CFileDialog doubt

CFileDialog doubt

Scheduled Pinned Locked Moved C / C++ / MFC
tutorial
16 Posts 4 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.
  • CPalliniC CPallini

    You should set the lpstrInitialDir member of the CFileDialog's m_ofn struct (see [^] and [^]). Please read carefully the documentation: file dialog behaviour is OS-dependant (for instance, Windows 7 behaves distinctively with respect the initial directory). :) [added] Wow! Damned *fast* Roger! [/added] :-D

    If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler. -- Alfonso the Wise, 13th Century King of Castile.
    This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong. -- Iain Clarke
    [My articles]

    U Offline
    U Offline
    User 4396598
    wrote on last edited by
    #7

    Thanks Pallini :) I have problem with filter, i am adding filter like this dlgFile.m_ofn.lpstrFilter = _T("*.pdm"); it has to display all .pdm files, but its not displaying .pdm files in the dialog. please help me in this regard. Thanks in advance. Regards, Anil

    CPalliniC 1 Reply Last reply
    0
    • CPalliniC CPallini

      You should set the lpstrInitialDir member of the CFileDialog's m_ofn struct (see [^] and [^]). Please read carefully the documentation: file dialog behaviour is OS-dependant (for instance, Windows 7 behaves distinctively with respect the initial directory). :) [added] Wow! Damned *fast* Roger! [/added] :-D

      If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler. -- Alfonso the Wise, 13th Century King of Castile.
      This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong. -- Iain Clarke
      [My articles]

      R Offline
      R Offline
      Roger Stoltz
      wrote on last edited by
      #8

      CPallini wrote:

      [added] Wow! Damned *fast* Roger! [/added]

      Yeah, but I've been waiting for that one for about two months without answering anything else, so I was *really* ready. :cool:

      "It's supposed to be hard, otherwise anybody could do it!" - selfquote
      "High speed never compensates for wrong direction!" - unknown

      CPalliniC 1 Reply Last reply
      0
      • R Roger Stoltz

        CPallini wrote:

        [added] Wow! Damned *fast* Roger! [/added]

        Yeah, but I've been waiting for that one for about two months without answering anything else, so I was *really* ready. :cool:

        "It's supposed to be hard, otherwise anybody could do it!" - selfquote
        "High speed never compensates for wrong direction!" - unknown

        CPalliniC Online
        CPalliniC Online
        CPallini
        wrote on last edited by
        #9

        Well, I cannot give way to "anyone waiting for about two months"... :-D

        If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler. -- Alfonso the Wise, 13th Century King of Castile.
        This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong. -- Iain Clarke
        [My articles]

        In testa che avete, signor di Ceprano?

        1 Reply Last reply
        0
        • U User 4396598

          Thanks Pallini :) I have problem with filter, i am adding filter like this dlgFile.m_ofn.lpstrFilter = _T("*.pdm"); it has to display all .pdm files, but its not displaying .pdm files in the dialog. please help me in this regard. Thanks in advance. Regards, Anil

          CPalliniC Online
          CPalliniC Online
          CPallini
          wrote on last edited by
          #10

          Member 4399771 wrote:

          dlgFile.m_ofn.lpstrFilter = _T("*.pdm");

          Should be

          dlgFile.m_ofn.lpstrFilter = _T("*.pdm\0");

          :)

          If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler. -- Alfonso the Wise, 13th Century King of Castile.
          This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong. -- Iain Clarke
          [My articles]

          In testa che avete, signor di Ceprano?

          U 1 Reply Last reply
          0
          • R Rajesh R Subramanian

            Yeah, there are a few interesting things that I'm trying out (involved in a research). Nothing new or profoundly exciting though. :)

            “Follow your bliss.” – Joseph Campbell

            CPalliniC Online
            CPalliniC Online
            CPallini
            wrote on last edited by
            #11

            Rajesh R Subramanian wrote:

            involved in a research

            Rajesh R Subramanian wrote:

            Nothing new or profoundly exciting though.

            I see a contraddiction, Watson! :-D

            If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler. -- Alfonso the Wise, 13th Century King of Castile.
            This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong. -- Iain Clarke
            [My articles]

            In testa che avete, signor di Ceprano?

            R 1 Reply Last reply
            0
            • CPalliniC CPallini

              Member 4399771 wrote:

              dlgFile.m_ofn.lpstrFilter = _T("*.pdm");

              Should be

              dlgFile.m_ofn.lpstrFilter = _T("*.pdm\0");

              :)

              If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler. -- Alfonso the Wise, 13th Century King of Castile.
              This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong. -- Iain Clarke
              [My articles]

              U Offline
              U Offline
              User 4396598
              wrote on last edited by
              #12

              Dear Pallini thanks for your reply! I tried with \0 still dialog not filtering. please check the code below.

              CFileDialog dlgFile(TRUE);
              CString fileName;
              const int c\_cMaxFiles = 100;
              const int c\_cbBuffSize = (c\_cMaxFiles \* (MAX\_PATH + 1)) + 1;
              dlgFile.GetOFN().lpstrFile = fileName.GetBuffer(c\_cbBuffSize);
              dlgFile.GetOFN().nMaxFile = c\_cMaxFiles;
              dlgFile.m\_ofn.lpstrInitialDir = m\_sWorkpathPdm;
              dlgFile.m\_ofn.lpstrFilter = \_T("\*.sct\\0");
              dlgFile.DoModal();
              fileName.ReleaseBuffer();
              if (!fileName.IsEmpty())
              	m\_sMapFileName = fileName;
              UpdateData(FALSE);
              

              Regards, Anil

              hi

              CPalliniC 1 Reply Last reply
              0
              • U User 4396598

                Dear Pallini thanks for your reply! I tried with \0 still dialog not filtering. please check the code below.

                CFileDialog dlgFile(TRUE);
                CString fileName;
                const int c\_cMaxFiles = 100;
                const int c\_cbBuffSize = (c\_cMaxFiles \* (MAX\_PATH + 1)) + 1;
                dlgFile.GetOFN().lpstrFile = fileName.GetBuffer(c\_cbBuffSize);
                dlgFile.GetOFN().nMaxFile = c\_cMaxFiles;
                dlgFile.m\_ofn.lpstrInitialDir = m\_sWorkpathPdm;
                dlgFile.m\_ofn.lpstrFilter = \_T("\*.sct\\0");
                dlgFile.DoModal();
                fileName.ReleaseBuffer();
                if (!fileName.IsEmpty())
                	m\_sMapFileName = fileName;
                UpdateData(FALSE);
                

                Regards, Anil

                hi

                CPalliniC Online
                CPalliniC Online
                CPallini
                wrote on last edited by
                #13

                Member 4399771 wrote:

                dlgFile.m_ofn.lpstrFilter = _T("*.sct\0");

                Change to

                dlgFile.m_ofn.lpstrFilter = _T("sct files\0*.sct\0");
                dlgFile.m_ofn.nFilterIndex = 1;

                :)

                If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler. -- Alfonso the Wise, 13th Century King of Castile.
                This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong. -- Iain Clarke
                [My articles]

                In testa che avete, signor di Ceprano?

                U 1 Reply Last reply
                0
                • CPalliniC CPallini

                  Member 4399771 wrote:

                  dlgFile.m_ofn.lpstrFilter = _T("*.sct\0");

                  Change to

                  dlgFile.m_ofn.lpstrFilter = _T("sct files\0*.sct\0");
                  dlgFile.m_ofn.nFilterIndex = 1;

                  :)

                  If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler. -- Alfonso the Wise, 13th Century King of Castile.
                  This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong. -- Iain Clarke
                  [My articles]

                  U Offline
                  U Offline
                  User 4396598
                  wrote on last edited by
                  #14

                  Thank you very much Pallini :) The problem is fixed! Is there any documentation available on this topic. Regards, Anil

                  CPalliniC 1 Reply Last reply
                  0
                  • U User 4396598

                    Thank you very much Pallini :) The problem is fixed! Is there any documentation available on this topic. Regards, Anil

                    CPalliniC Online
                    CPalliniC Online
                    CPallini
                    wrote on last edited by
                    #15

                    Member 4399771 wrote:

                    Thank you very much Pallini

                    You are welcome.

                    Member 4399771 wrote:

                    Is there any documentation available on this topic.

                    There is, of course:

                    • CFileDialog class
                    • OPENFILENAME Structure
                    • Using Common Dialog Boxes : Opening a file

                    :)

                    If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler. -- Alfonso the Wise, 13th Century King of Castile.
                    This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong. -- Iain Clarke
                    [My articles]

                    In testa che avete, signor di Ceprano?

                    1 Reply Last reply
                    0
                    • CPalliniC CPallini

                      Rajesh R Subramanian wrote:

                      involved in a research

                      Rajesh R Subramanian wrote:

                      Nothing new or profoundly exciting though.

                      I see a contraddiction, Watson! :-D

                      If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler. -- Alfonso the Wise, 13th Century King of Castile.
                      This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong. -- Iain Clarke
                      [My articles]

                      R Offline
                      R Offline
                      Rajesh R Subramanian
                      wrote on last edited by
                      #16

                      Problem is, it isn't anywhere in my area of interests that I'm "researching" on. :)

                      “Follow your bliss.” – Joseph Campbell

                      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