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

Question

Scheduled Pinned Locked Moved C / C++ / MFC
helpquestionc++
20 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.
  • R Offline
    R Offline
    rfixxxer
    wrote on last edited by
    #1

    I finally made my MFC(GUI) project,but have a problem,after working succesfully once,for second time it doesnt work anymore!(without exiting form GUI). What can be the problem?Can someone please help?Maybe i need toreinitialize or free something? Alex

    D M D 4 Replies Last reply
    0
    • R rfixxxer

      I finally made my MFC(GUI) project,but have a problem,after working succesfully once,for second time it doesnt work anymore!(without exiting form GUI). What can be the problem?Can someone please help?Maybe i need toreinitialize or free something? Alex

      D Offline
      D Offline
      dipeka
      wrote on last edited by
      #2

      If ur using some mutex see that u release the mutex. Hope this helps Dipeka.A.J

      R 1 Reply Last reply
      0
      • R rfixxxer

        I finally made my MFC(GUI) project,but have a problem,after working succesfully once,for second time it doesnt work anymore!(without exiting form GUI). What can be the problem?Can someone please help?Maybe i need toreinitialize or free something? Alex

        M Offline
        M Offline
        Maximilien
        wrote on last edited by
        #3

        what doesn't work anymore ? have you checked the usuals ( memory leak, resource leak, ... ) ? what are the symptoms ?


        Maximilien Lincourt Your Head A Splode - Strong Bad

        R 1 Reply Last reply
        0
        • D dipeka

          If ur using some mutex see that u release the mutex. Hope this helps Dipeka.A.J

          R Offline
          R Offline
          rfixxxer
          wrote on last edited by
          #4

          No,no mutex is used.. Ill detail more: my project(parser XML) i allow user to enter filename of file to be parsed and directories for log files(regularTXT and html) and then allow start parsing(only if user entered file and directory). For translating txt log file to html i have checkbox and if its marked then html-convert function also starts working.. If ots not enough please tell me,also ill post the code tomoroow(although its quite long for posting) Thank you Alex

          1 Reply Last reply
          0
          • M Maximilien

            what doesn't work anymore ? have you checked the usuals ( memory leak, resource leak, ... ) ? what are the symptoms ?


            Maximilien Lincourt Your Head A Splode - Strong Bad

            R Offline
            R Offline
            rfixxxer
            wrote on last edited by
            #5

            I did check the usuals.. Here some details: My project(parser XML) i allow user to enter filename of file to be parsed and directories for log files(regularTXT and html) and then allow start parsing(only if user entered file and directory). For translating txt log file to html i have checkbox and if its marked then html-convert function also starts working.. So the problem is after working once,if i want to enter filename e.t.c. once more,it allows entering but it doesnt work..(if i exit from gui interface and start the programm over again it does work(but again just once),but i need it to work without exiting.. If its not enough please tell me,also ill post the code tomoroow(although its quite long for posting) Thank you Alex

            M 1 Reply Last reply
            0
            • R rfixxxer

              I finally made my MFC(GUI) project,but have a problem,after working succesfully once,for second time it doesnt work anymore!(without exiting form GUI). What can be the problem?Can someone please help?Maybe i need toreinitialize or free something? Alex

              D Offline
              D Offline
              dipeka
              wrote on last edited by
              #6

              Is ur project dialog based? Are u using any event handling? This may help to think over the problem Dipeka.A.J

              R D 3 Replies Last reply
              0
              • R rfixxxer

                I finally made my MFC(GUI) project,but have a problem,after working succesfully once,for second time it doesnt work anymore!(without exiting form GUI). What can be the problem?Can someone please help?Maybe i need toreinitialize or free something? Alex

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

                You've not provided near enough information. Any attempt at a solution at this point would be futile at best. What does the program do? What are the symptoms? Has it ever worked two or more times? When the program is supposed to "run" a second time, have you stepped through the code from that point to see what is failing? Have you trimmed away all unnecessary code so that what's left is just enough to reproduce the problem?


                "When I was born I was so surprised that I didn't talk for a year and a half." - Gracie Allen

                R 1 Reply Last reply
                0
                • D dipeka

                  Is ur project dialog based? Are u using any event handling? This may help to think over the problem Dipeka.A.J

                  R Offline
                  R Offline
                  rfixxxer
                  wrote on last edited by
                  #8

                  Dialog Based-Yes,aloso have Start button which triggers start of programm Event-No ThAnks Alex

                  1 Reply Last reply
                  0
                  • R rfixxxer

                    I did check the usuals.. Here some details: My project(parser XML) i allow user to enter filename of file to be parsed and directories for log files(regularTXT and html) and then allow start parsing(only if user entered file and directory). For translating txt log file to html i have checkbox and if its marked then html-convert function also starts working.. So the problem is after working once,if i want to enter filename e.t.c. once more,it allows entering but it doesnt work..(if i exit from gui interface and start the programm over again it does work(but again just once),but i need it to work without exiting.. If its not enough please tell me,also ill post the code tomoroow(although its quite long for posting) Thank you Alex

                    M Offline
                    M Offline
                    Maximilien
                    wrote on last edited by
                    #9

                    did you close the files ? re-initialize variable ? reset the state of the parser ? as david wrote, did you trace the problem by putting breakpoints to see ( or try to see ) when in the execution path your program stop working properly ? don't post ALL the code, only the portions that doesn't work ( and after you really "cornered" the bug and/or the offensive function )


                    Maximilien Lincourt Your Head A Splode - Strong Bad

                    R 2 Replies Last reply
                    0
                    • D David Crow

                      You've not provided near enough information. Any attempt at a solution at this point would be futile at best. What does the program do? What are the symptoms? Has it ever worked two or more times? When the program is supposed to "run" a second time, have you stepped through the code from that point to see what is failing? Have you trimmed away all unnecessary code so that what's left is just enough to reproduce the problem?


                      "When I was born I was so surprised that I didn't talk for a year and a half." - Gracie Allen

                      R Offline
                      R Offline
                      rfixxxer
                      wrote on last edited by
                      #10

                      Hello, Ill detail more: My project(parser XML) i allow user to enter filename of file to be parsed and directories for log files(regularTXT and html) and then allow start parsing by pressing Start button which triggers start of work(only if user entered file and directory). For translating txt log file to html i have checkbox and if its marked then html-convert function also starts working.. If its not enough please tell me,also ill post the code tomoroow(although its long for posting)..And no it never worked more than once.. Symptoms are that for second try of running it does get the input but doesnt perform necessary actions as in first time.. I debugged my functions and its fine,couldnt debug GUI(mfcDlg.cpp)yet.. Thank you, Alex

                      D 1 Reply Last reply
                      0
                      • M Maximilien

                        did you close the files ? re-initialize variable ? reset the state of the parser ? as david wrote, did you trace the problem by putting breakpoints to see ( or try to see ) when in the execution path your program stop working properly ? don't post ALL the code, only the portions that doesn't work ( and after you really "cornered" the bug and/or the offensive function )


                        Maximilien Lincourt Your Head A Splode - Strong Bad

                        R Offline
                        R Offline
                        rfixxxer
                        wrote on last edited by
                        #11

                        Ok,i'll try to find the problematic place in code exactly,and i'll tell here.. Thank you, Alex

                        1 Reply Last reply
                        0
                        • R rfixxxer

                          Hello, Ill detail more: My project(parser XML) i allow user to enter filename of file to be parsed and directories for log files(regularTXT and html) and then allow start parsing by pressing Start button which triggers start of work(only if user entered file and directory). For translating txt log file to html i have checkbox and if its marked then html-convert function also starts working.. If its not enough please tell me,also ill post the code tomoroow(although its long for posting)..And no it never worked more than once.. Symptoms are that for second try of running it does get the input but doesnt perform necessary actions as in first time.. I debugged my functions and its fine,couldnt debug GUI(mfcDlg.cpp)yet.. Thank you, Alex

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

                          For starters, set a breakpoint in the handler for the Start button. Begin debugging at that point. You might also consider judiciously-placed ASSERT() statements. They alert you when the state of your program is not what you think/expect it to be.


                          "When I was born I was so surprised that I didn't talk for a year and a half." - Gracie Allen

                          R 1 Reply Last reply
                          0
                          • D David Crow

                            For starters, set a breakpoint in the handler for the Start button. Begin debugging at that point. You might also consider judiciously-placed ASSERT() statements. They alert you when the state of your program is not what you think/expect it to be.


                            "When I was born I was so surprised that I didn't talk for a year and a half." - Gracie Allen

                            R Offline
                            R Offline
                            rfixxxer
                            wrote on last edited by
                            #13

                            I think the problem is that when i start programm for second time it has some problems with reading from the source (XML)file(.xml).. Im opening the file with GUI by using CFileDialog and also f.open in function and closing just with f.close ..Could that be the problem? If yes how do i close it with GUI? And also,Do i need to call OnInitDialog function after the programm ends for the first time? Thank you very much, Alex

                            D 1 Reply Last reply
                            0
                            • R rfixxxer

                              I think the problem is that when i start programm for second time it has some problems with reading from the source (XML)file(.xml).. Im opening the file with GUI by using CFileDialog and also f.open in function and closing just with f.close ..Could that be the problem? If yes how do i close it with GUI? And also,Do i need to call OnInitDialog function after the programm ends for the first time? Thank you very much, Alex

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

                              rfixxxer wrote: Im opening the file with GUI... How you open a file and whether the program has a GUI are mutually exclusive things. rfixxxer wrote: ...f.open in function and closing just with f.close ..Could that be the problem? I don't see how, as long as the file opened and closed with no errors. rfixxxer wrote: If yes how do i close it with GUI? Again, the opening and closing of a file is independent of whether it has a GUI or not. The key here is consistency. If you opened the file as a stream, it must be closed as a stream. If you opened the file as a handle, it must be closed as a handle. No mixing! rfixxxer wrote: Do i need to call OnInitDialog... Only as a child class calling its base class implementation. Otherwise, this function is called by the framework in response to a WM_INITDIALOG message.


                              "When I was born I was so surprised that I didn't talk for a year and a half." - Gracie Allen

                              R 1 Reply Last reply
                              0
                              • D David Crow

                                rfixxxer wrote: Im opening the file with GUI... How you open a file and whether the program has a GUI are mutually exclusive things. rfixxxer wrote: ...f.open in function and closing just with f.close ..Could that be the problem? I don't see how, as long as the file opened and closed with no errors. rfixxxer wrote: If yes how do i close it with GUI? Again, the opening and closing of a file is independent of whether it has a GUI or not. The key here is consistency. If you opened the file as a stream, it must be closed as a stream. If you opened the file as a handle, it must be closed as a handle. No mixing! rfixxxer wrote: Do i need to call OnInitDialog... Only as a child class calling its base class implementation. Otherwise, this function is called by the framework in response to a WM_INITDIALOG message.


                                "When I was born I was so surprised that I didn't talk for a year and a half." - Gracie Allen

                                R Offline
                                R Offline
                                rfixxxer
                                wrote on last edited by
                                #15

                                Problem solved!!! It was a small thing actually.. Thank you very much for the help,i'm thankfull Alex

                                1 Reply Last reply
                                0
                                • D dipeka

                                  Is ur project dialog based? Are u using any event handling? This may help to think over the problem Dipeka.A.J

                                  R Offline
                                  R Offline
                                  rfixxxer
                                  wrote on last edited by
                                  #16

                                  Problem solved!!! It was a small thing actually.. Thank you very much for the help,i'm thankfull Alex

                                  D 1 Reply Last reply
                                  0
                                  • M Maximilien

                                    did you close the files ? re-initialize variable ? reset the state of the parser ? as david wrote, did you trace the problem by putting breakpoints to see ( or try to see ) when in the execution path your program stop working properly ? don't post ALL the code, only the portions that doesn't work ( and after you really "cornered" the bug and/or the offensive function )


                                    Maximilien Lincourt Your Head A Splode - Strong Bad

                                    R Offline
                                    R Offline
                                    rfixxxer
                                    wrote on last edited by
                                    #17

                                    Problem solved!!! It was a small thing actually..Forgot to reset a global variable.. Thank you very much for the help,i'm thankfull Alex

                                    D 1 Reply Last reply
                                    0
                                    • R rfixxxer

                                      Problem solved!!! It was a small thing actually..Forgot to reset a global variable.. Thank you very much for the help,i'm thankfull Alex

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

                                      rfixxxer wrote: Forgot to reset a global variable Which is one of the primary reasons for not using them. Good luck.


                                      "When I was born I was so surprised that I didn't talk for a year and a half." - Gracie Allen

                                      1 Reply Last reply
                                      0
                                      • D dipeka

                                        Is ur project dialog based? Are u using any event handling? This may help to think over the problem Dipeka.A.J

                                        D Offline
                                        D Offline
                                        dipeka
                                        wrote on last edited by
                                        #19

                                        It's great u have discovered the problem!!! All the best Dipeka.A.J

                                        1 Reply Last reply
                                        0
                                        • R rfixxxer

                                          Problem solved!!! It was a small thing actually.. Thank you very much for the help,i'm thankfull Alex

                                          D Offline
                                          D Offline
                                          dipeka
                                          wrote on last edited by
                                          #20

                                          It's great u have discovered the problem!!!!! All the best Dipeka.A.J

                                          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