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 doesn't update when I change the file type.

CFileDialog doesn't update when I change the file type.

Scheduled Pinned Locked Moved C / C++ / MFC
helpquestiontutorialannouncement
16 Posts 6 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.
  • I IlanTal

    That was a great idea to try the Release as well as the Debug. I didn't think of that. Unfortunately, it also has the problem in Release. I also added mpeg and it indeed gave me 3 choices as expected. Still the refresh problem is there. I looked in a couple of other programs I have and the problem exists there as well. I just never noticed it until today. Maybe it is connected to .NET which I added fairly recently? Hard to believe, but who knows. It is strange that I never would have seen this before. BTW, I have an avi file in the directory, so even if I put avi files first I will still see them properly. It is only when I pull down the combo box and change the file type that the refresh fails. I'm really stuck as to why.

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

    Just out of curiousity: does the behaviour remain if you set the OFN_EXPLORER flag as well? I'm thinking about some events that does not occur if the OFN_EXPLORER flag is omitted, e.g. OnTypeChange. -- Roger


    It's supposed to be hard, otherwise anybody could do it!

    I 1 Reply Last reply
    0
    • I IlanTal

      I am using CFileDialog for a "save as" where I have to choices for file types: All Files or Avi Files. I just noticed something very strange and wondered if anyone else has seen the same thing, or better knows how to fix it. First of all, the "save as" function is done correctly, so 99% of the problem is solved. It comes up with All Files and indeed shows all files. The problem comes when I change to show only avi files. The window goes blank. If I go back to all files, it stays blank. Only if I choose a different folder is it refreshed properly (with either all or avi files). I tried it in Paint and there if you change the file type, the window refreshes correctly. In CFileDialog it doesn't. My code is: CFileDialog filedlg( FALSE, "avi", // default extension "mip1.avi", // current file name OFN_FILEMUSTEXIST | OFN_PATHMUSTEXIST | OFN_LONGNAMES, "All Files (*.*)|*.*|Avi Files (*.avi)|*.avi||", NULL); Has anyone else seen this, or can tell me what is wrong? Thanks, Ilan

      D Offline
      D Offline
      David Crow
      wrote on last edited by
      #8

      Your code snippet works fine for me. What happens if you use GetOpenFileName() instead?


      "Let us be thankful for the fools. But for them the rest of us could not succeed." - Mark Twain

      "There is no death, only a change of worlds." - Native American Proverb

      I 1 Reply Last reply
      0
      • I IlanTal

        I am using CFileDialog for a "save as" where I have to choices for file types: All Files or Avi Files. I just noticed something very strange and wondered if anyone else has seen the same thing, or better knows how to fix it. First of all, the "save as" function is done correctly, so 99% of the problem is solved. It comes up with All Files and indeed shows all files. The problem comes when I change to show only avi files. The window goes blank. If I go back to all files, it stays blank. Only if I choose a different folder is it refreshed properly (with either all or avi files). I tried it in Paint and there if you change the file type, the window refreshes correctly. In CFileDialog it doesn't. My code is: CFileDialog filedlg( FALSE, "avi", // default extension "mip1.avi", // current file name OFN_FILEMUSTEXIST | OFN_PATHMUSTEXIST | OFN_LONGNAMES, "All Files (*.*)|*.*|Avi Files (*.avi)|*.avi||", NULL); Has anyone else seen this, or can tell me what is wrong? Thanks, Ilan

        H Offline
        H Offline
        Hamid Taebi
        wrote on last edited by
        #9

        Hi IlanTal, your code worked. Whats problem?

        I 1 Reply Last reply
        0
        • R Roger Stoltz

          Just out of curiousity: does the behaviour remain if you set the OFN_EXPLORER flag as well? I'm thinking about some events that does not occur if the OFN_EXPLORER flag is omitted, e.g. OnTypeChange. -- Roger


          It's supposed to be hard, otherwise anybody could do it!

          I Offline
          I Offline
          IlanTal
          wrote on last edited by
          #10

          That was an idea worth investigating. It turns out that OFN_EXPLORER has no connection to the problem. I added the flag and it works correctly when "Use managed extensions" is No and incorrectly when it is Yes. Now I have complete control of when it appears. Unfortunately, in the real world I need managed extensions since I use the .NET, but at least I know where the problem is. That is more than I knew when I started to ask questions on the board. The bottom line: the code project is very useful....

          D 1 Reply Last reply
          0
          • D David Crow

            Your code snippet works fine for me. What happens if you use GetOpenFileName() instead?


            "Let us be thankful for the fools. But for them the rest of us could not succeed." - Mark Twain

            "There is no death, only a change of worlds." - Native American Proverb

            I Offline
            I Offline
            IlanTal
            wrote on last edited by
            #11

            Thanks. Look above. It is the .NET which is causing the problem.

            D 1 Reply Last reply
            0
            • H Hamid Taebi

              Hi IlanTal, your code worked. Whats problem?

              I Offline
              I Offline
              IlanTal
              wrote on last edited by
              #12

              Likewise, thanks. It is .NET. Look above on the board.

              1 Reply Last reply
              0
              • I IlanTal

                Thanks. Look above. It is the .NET which is causing the problem.

                D Offline
                D Offline
                David Crow
                wrote on last edited by
                #13

                IlanTal wrote:

                It is the .NET which is causing the problem.

                How so? I have v1.1 of the .NET Framework installed.


                "Let us be thankful for the fools. But for them the rest of us could not succeed." - Mark Twain

                "There is no death, only a change of worlds." - Native American Proverb

                I 1 Reply Last reply
                0
                • I IlanTal

                  That was an idea worth investigating. It turns out that OFN_EXPLORER has no connection to the problem. I added the flag and it works correctly when "Use managed extensions" is No and incorrectly when it is Yes. Now I have complete control of when it appears. Unfortunately, in the real world I need managed extensions since I use the .NET, but at least I know where the problem is. That is more than I knew when I started to ask questions on the board. The bottom line: the code project is very useful....

                  D Offline
                  D Offline
                  David Crow
                  wrote on last edited by
                  #14

                  IlanTal wrote:

                  ...I need managed extensions...

                  Is this a Managed C++ question? If so, have you tried here?


                  "Let us be thankful for the fools. But for them the rest of us could not succeed." - Mark Twain

                  "There is no death, only a change of worlds." - Native American Proverb

                  I 1 Reply Last reply
                  0
                  • D David Crow

                    IlanTal wrote:

                    It is the .NET which is causing the problem.

                    How so? I have v1.1 of the .NET Framework installed.


                    "Let us be thankful for the fools. But for them the rest of us could not succeed." - Mark Twain

                    "There is no death, only a change of worlds." - Native American Proverb

                    I Offline
                    I Offline
                    IlanTal
                    wrote on last edited by
                    #15

                    Did you see my reply to Roger? I have COMPLETE control of when it happens, just turn on or off managed extensions and Voila!

                    1 Reply Last reply
                    0
                    • D David Crow

                      IlanTal wrote:

                      ...I need managed extensions...

                      Is this a Managed C++ question? If so, have you tried here?


                      "Let us be thankful for the fools. But for them the rest of us could not succeed." - Mark Twain

                      "There is no death, only a change of worlds." - Native American Proverb

                      I Offline
                      I Offline
                      IlanTal
                      wrote on last edited by
                      #16

                      Now, thanks to this board, I know it is a problem with managed extensions. When I started, it never occured to me that the problem could be there.

                      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