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 error - check code [modified]

Dialog box error - check code [modified]

Scheduled Pinned Locked Moved C / C++ / MFC
helpquestion
8 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.
  • D Offline
    D Offline
    Dustin Henry
    wrote on last edited by
    #1

    I have class derived from CFileDialog that keeps failing when I select to many files (4-5 works fine). My problem is that I want to find out why it is failing, but the only way I can find to do this is by using CommDlgExtendedError(). However, I cannot check the return code against the values as stated in MSDN because they don't actually seem to be defined anywhere(including Commdlg.h). I don't know if this is a VS2005 issue or not. The code being returned is 12291. Any suggestions? Dustin -- modified at 17:29 Tuesday 24th April, 2007

    M D 2 Replies Last reply
    0
    • D Dustin Henry

      I have class derived from CFileDialog that keeps failing when I select to many files (4-5 works fine). My problem is that I want to find out why it is failing, but the only way I can find to do this is by using CommDlgExtendedError(). However, I cannot check the return code against the values as stated in MSDN because they don't actually seem to be defined anywhere(including Commdlg.h). I don't know if this is a VS2005 issue or not. The code being returned is 12291. Any suggestions? Dustin -- modified at 17:29 Tuesday 24th April, 2007

      M Offline
      M Offline
      Mark Salsbery
      wrote on last edited by
      #2

      12291 == 0x3003 == FNERR_BUFFERTOOSMALL Clearly documented in the SDK under CommDlgExtendedError()... "The CommDlgExtendedError function returns a common dialog box error code. This code indicates the most recent error to occur during the execution of one of the common dialog box functions. These error codes are defined in Cderr.h." ;P

      "Posting a VB.NET question in the C++ forum will end in tears." Chris Maunder

      D 1 Reply Last reply
      0
      • M Mark Salsbery

        12291 == 0x3003 == FNERR_BUFFERTOOSMALL Clearly documented in the SDK under CommDlgExtendedError()... "The CommDlgExtendedError function returns a common dialog box error code. This code indicates the most recent error to occur during the execution of one of the common dialog box functions. These error codes are defined in Cderr.h." ;P

        "Posting a VB.NET question in the C++ forum will end in tears." Chris Maunder

        D Offline
        D Offline
        Dustin Henry
        wrote on last edited by
        #3

        Now what are the odds that the answer would be in the first line of the help file.:) I did actually find that a few minutes ago and have been trying to increase my buffer size by changing the OPENFILENAME.nMaxFile, but this is appearantly causing memory to be over written and failing on initialization of the dialog. I'm getting an access violation error and the call stack shows only assembly. Any idea how to correctly increase the buffer size? Dustin

        M 1 Reply Last reply
        0
        • D Dustin Henry

          Now what are the odds that the answer would be in the first line of the help file.:) I did actually find that a few minutes ago and have been trying to increase my buffer size by changing the OPENFILENAME.nMaxFile, but this is appearantly causing memory to be over written and failing on initialization of the dialog. I'm getting an access violation error and the call stack shows only assembly. Any idea how to correctly increase the buffer size? Dustin

          M Offline
          M Offline
          Mark Salsbery
          wrote on last edited by
          #4

          Dustin Henry wrote:

          Now what are the odds that the answer would be in the first line of the help file.

          :laugh: that's the reason for my smart-alec reply :) Increasing OPENFILENAME.nMaxFile isn't the only thing you need to do. You also need to increase the size of the buffer pointed to by OPENFILENAME.lpstrFile. //example DWORD dwMaxFileLength = MAX_PATH * 10; MyOFN.lpstrFile = new TCHAR[dwMaxFileLength]; MyOFN.nMaxFile = dwMaxFileLength; ... delete[] MyOFN.lpstrFile;

          "Posting a VB.NET question in the C++ forum will end in tears." Chris Maunder

          D 1 Reply Last reply
          0
          • M Mark Salsbery

            Dustin Henry wrote:

            Now what are the odds that the answer would be in the first line of the help file.

            :laugh: that's the reason for my smart-alec reply :) Increasing OPENFILENAME.nMaxFile isn't the only thing you need to do. You also need to increase the size of the buffer pointed to by OPENFILENAME.lpstrFile. //example DWORD dwMaxFileLength = MAX_PATH * 10; MyOFN.lpstrFile = new TCHAR[dwMaxFileLength]; MyOFN.nMaxFile = dwMaxFileLength; ... delete[] MyOFN.lpstrFile;

            "Posting a VB.NET question in the C++ forum will end in tears." Chris Maunder

            D Offline
            D Offline
            Dustin Henry
            wrote on last edited by
            #5

            That fixed it. Thanks for the help Mark.:)

            M 1 Reply Last reply
            0
            • D Dustin Henry

              That fixed it. Thanks for the help Mark.:)

              M Offline
              M Offline
              Mark Salsbery
              wrote on last edited by
              #6

              No problem! I thought I'd mention that "MAX_PATH * 10" was arbitrary. It may be a good idea to consider how many files a typical user will select normally and adjust the size accordingly. You'll have one path and how ever many filenames. I have no personal set formula. I chose MAX_PATH * 32 in my apps for multiple-select file dialogs for no reason other than that's the first thing that came to mind and roughly 8K (16K for Unicode) bytes of temporary memory is cheap :) I bet 1/10th of that has never been exceeded :laugh:. Have fun! Mark

              "Posting a VB.NET question in the C++ forum will end in tears." Chris Maunder

              1 Reply Last reply
              0
              • D Dustin Henry

                I have class derived from CFileDialog that keeps failing when I select to many files (4-5 works fine). My problem is that I want to find out why it is failing, but the only way I can find to do this is by using CommDlgExtendedError(). However, I cannot check the return code against the values as stated in MSDN because they don't actually seem to be defined anywhere(including Commdlg.h). I don't know if this is a VS2005 issue or not. The code being returned is 12291. Any suggestions? Dustin -- modified at 17:29 Tuesday 24th April, 2007

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

                Can't you use the Error Lookup (errlook.exe) tool that ships with VS?


                "A good athlete is the result of a good and worthy opponent." - David Crow

                "To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne

                R 1 Reply Last reply
                0
                • D David Crow

                  Can't you use the Error Lookup (errlook.exe) tool that ships with VS?


                  "A good athlete is the result of a good and worthy opponent." - David Crow

                  "To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne

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

                  Probably he got the error code ERR_ASK_AT_CP

                  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