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. Question about CFileDialog class

Question about CFileDialog class

Scheduled Pinned Locked Moved C / C++ / MFC
databasedata-structuresdebugginghelpquestion
20 Posts 7 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.
  • R Roger Stoltz

    What does the call stack look like? Is there any line that points to code for which you have source code? I assume you have built your application for debug...:~ -- Rog


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

    "No one remembers a coward!" - Jan Elfström 1998
    "...but everyone remembers an idiot!" - my lawyer 2005 when heard of Jan's saying above

    E Offline
    E Offline
    eusto
    wrote on last edited by
    #11

    no...debug does not point to my code:(

    1 Reply Last reply
    0
    • E eusto

      ...it dies during CFileDialog::DoModal() method (i mean, it dies while my dialog waits for CFileDialog::DoModal() to return)

      7CA5159E call dword ptr [ecx+14h]

      That's the disassembly code, but i don't know what to do with it, i don't think it helps

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

      Did you try displaying a message box before and after your CFileDialog creation? What happens in that case?


      Nobody can give you wiser advice than yourself. - Cicero ப்ரம்மா

      E 1 Reply Last reply
      0
      • E eusto

        I have a dialog with two browse buttons on it. If i press the frist one, select a file than press the seccond one, my application crashes and i can't figure out why :( . Here's the code:

        //first browse button
        void CAddEquipDlg::OnBnClickedBrowsedb()
        {
        char szFilters[]=
        "Access DB (*.mdb)|*.mdb|All Files (*.*)|*.*||";

        CFileDialog fDlg(TRUE,
            "mdb",
            "\*.mdb",
            OFN\_FILEMUSTEXIST| OFN\_HIDEREADONLY,
            szFilters, 
            NULL
            );
        if (fDlg.DoModal()==IDOK)
        {
            m\_sDB = fDlg.GetPathName();
        }
        SetCurrentDirectory(m\_sCurDir);
        SetDlgItemText(IDC\_DB,m\_sDB);
        AfxGetApp()->WriteProfileString("Connection", "Database",m\_sDB);
        

        }
        //seccond browse button
        void CAddEquipDlg::OnBnClickedBrowseequip()
        {

        char szFilters\[\]=
            "CSV Files (\*.csv)|\*.csv|All Files (\*.\*)|\*.\*||";
        
        CFileDialog fDlg(TRUE,
            "csv",
            "\*.csv",
            OFN\_FILEMUSTEXIST| OFN\_HIDEREADONLY,
            szFilters, 
            NULL
            );
        if (fDlg.DoModal()==IDOK)
        {
            CString bla = fDlg.GetFileTitle();
            m\_sEQUIP = fDlg.GetPathName();
        }
        SetCurrentDirectory(m\_sCurDir);
        SetDlgItemText(IDC\_EQUIP,m\_sEQUIP);    
        

        }

        It crashes two out of tree times (with a send/don't send error message in release) and this is the debug info

        First-chance exception at 0x7ca5159e in AddEquip.exe: 0xC0000005: Access violation reading location 0x62883720.
        Unhandled exception at 0x7ca5159e in AddEquip.exe: 0xC0000005: Access violation reading location 0x62883720.

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

        eusto wrote:

        If i press the frist one, select a file than press the seccond one, my application crashes...

        What happens if you reverse this process? Which of the four statements after DoModal() is crashing? Set a breakpoint to find out.


        "Approved Workmen Are Not Ashamed" - 2 Timothy 2:15

        "Judge not by the eye but by the heart." - Native American Proverb

        E 1 Reply Last reply
        0
        • R Rajesh R Subramanian

          Did you try displaying a message box before and after your CFileDialog creation? What happens in that case?


          Nobody can give you wiser advice than yourself. - Cicero ப்ரம்மா

          E Offline
          E Offline
          eusto
          wrote on last edited by
          #14

          it dies only if there's verry little time between pressing the two buttons. If i put a message box anywhere...it will work

          1 Reply Last reply
          0
          • D David Crow

            eusto wrote:

            If i press the frist one, select a file than press the seccond one, my application crashes...

            What happens if you reverse this process? Which of the four statements after DoModal() is crashing? Set a breakpoint to find out.


            "Approved Workmen Are Not Ashamed" - 2 Timothy 2:15

            "Judge not by the eye but by the heart." - Native American Proverb

            E Offline
            E Offline
            eusto
            wrote on last edited by
            #15

            None of the four statements after DoModal() is crashing!..none! DoModal() doesn't even return. Anyways, i've narrowed it down. It crashes when i move trough folders in the CFileDialog window. And it doesn't really matter wich of the two buttons i press first.

            D 1 Reply Last reply
            0
            • E eusto

              None of the four statements after DoModal() is crashing!..none! DoModal() doesn't even return. Anyways, i've narrowed it down. It crashes when i move trough folders in the CFileDialog window. And it doesn't really matter wich of the two buttons i press first.

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

              This is just a complete guess, but how about commenting out everything after the DoModal() call?


              "Approved Workmen Are Not Ashamed" - 2 Timothy 2:15

              "Judge not by the eye but by the heart." - Native American Proverb

              E 1 Reply Last reply
              0
              • D David Crow

                This is just a complete guess, but how about commenting out everything after the DoModal() call?


                "Approved Workmen Are Not Ashamed" - 2 Timothy 2:15

                "Judge not by the eye but by the heart." - Native American Proverb

                E Offline
                E Offline
                eusto
                wrote on last edited by
                #17

                this was my last resort too but it still failed :(. I'm putting this thing to rest and i'll get to it some other time... Maybe there's a problem with my computer( a virus or smth...don't know ). The problem is clearly in the CFileDialog class but i can't figure it out.

                D 1 Reply Last reply
                0
                • E eusto

                  this was my last resort too but it still failed :(. I'm putting this thing to rest and i'll get to it some other time... Maybe there's a problem with my computer( a virus or smth...don't know ). The problem is clearly in the CFileDialog class but i can't figure it out.

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

                  eusto wrote:

                  The problem is clearly in the CFileDialog class...

                  To further verify that, use GetOpenFileName() instead.


                  "Approved Workmen Are Not Ashamed" - 2 Timothy 2:15

                  "Judge not by the eye but by the heart." - Native American Proverb

                  E 2 Replies Last reply
                  0
                  • D David Crow

                    eusto wrote:

                    The problem is clearly in the CFileDialog class...

                    To further verify that, use GetOpenFileName() instead.


                    "Approved Workmen Are Not Ashamed" - 2 Timothy 2:15

                    "Judge not by the eye but by the heart." - Native American Proverb

                    E Offline
                    E Offline
                    eusto
                    wrote on last edited by
                    #19

                    I've used GetOpenFileName() and it behaves just the same :(

                    1 Reply Last reply
                    0
                    • D David Crow

                      eusto wrote:

                      The problem is clearly in the CFileDialog class...

                      To further verify that, use GetOpenFileName() instead.


                      "Approved Workmen Are Not Ashamed" - 2 Timothy 2:15

                      "Judge not by the eye but by the heart." - Native American Proverb

                      E Offline
                      E Offline
                      eusto
                      wrote on last edited by
                      #20

                      Nevermind, sorry for bugging you so much. I've recompiled the project on another machine and it works like a charm. I guess the problem is in my VStudio instalation or something...i don't know

                      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