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
CODE PROJECT For Those Who Code
  • Home
  • Articles
  • FAQ
Community
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. problems with forcibly closing the .exe

problems with forcibly closing the .exe

Scheduled Pinned Locked Moved C / C++ / MFC
11 Posts 5 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.
  • A Offline
    A Offline
    ask_you
    wrote on last edited by
    #1

    Firstly, the application that i developed closes forcibly when i press ENTER. which event should i handle so that the the application does respond to ENTER command. Secondly, from the task manager when i select my application and do end process, the application closes forcibly. Which event should i handle in these case so that my app does some clean-up operation which i would like to do on exit. ask_you

    realJSOPR M 2 Replies Last reply
    0
    • A ask_you

      Firstly, the application that i developed closes forcibly when i press ENTER. which event should i handle so that the the application does respond to ENTER command. Secondly, from the task manager when i select my application and do end process, the application closes forcibly. Which event should i handle in these case so that my app does some clean-up operation which i would like to do on exit. ask_you

      realJSOPR Offline
      realJSOPR Offline
      realJSOP
      wrote on last edited by
      #2

      Firstly, the application that i developed closes forcibly when i press ENTER. which event should i handle so that the the application does respond to ENTER command. My guess is that you are writing a dialog-based app and there's an OK button in it. The easy way to prevent the program from closing when you hit ENTER is to 1) change the ID of the OK button from IDOK to IDC_OK 2) Delete the OnOK handler from your code. 3) Add a new handler for IDC_OK. Of course, there may be other ways to accomplish the same end, but I'm not really in a position to suggest anything more complex right now. ---------- Secondly, from the task manager when i select my application and do end process, the application closes forcibly. Which event should i handle in these case so that my app does some clean-up operation which i would like to do on exit. Handdle cleanup in the destructor of the dialog if possible. If you need to, you can also use the destructor for the app, or even OnExitInstance. ------- sig starts "I've heard some drivers saying, 'We're going too fast here...'. If you're not here to race, go the hell home - don't come here and grumble about going too fast. Why don't you tie a kerosene rag around your ankles so the ants won't climb up and eat your candy ass..." - Dale Earnhardt "...the staggering layers of obscenity in your statement make it a work of art on so many levels." - Jason Jystad, 10/26/2001

      A 1 Reply Last reply
      0
      • realJSOPR realJSOP

        Firstly, the application that i developed closes forcibly when i press ENTER. which event should i handle so that the the application does respond to ENTER command. My guess is that you are writing a dialog-based app and there's an OK button in it. The easy way to prevent the program from closing when you hit ENTER is to 1) change the ID of the OK button from IDOK to IDC_OK 2) Delete the OnOK handler from your code. 3) Add a new handler for IDC_OK. Of course, there may be other ways to accomplish the same end, but I'm not really in a position to suggest anything more complex right now. ---------- Secondly, from the task manager when i select my application and do end process, the application closes forcibly. Which event should i handle in these case so that my app does some clean-up operation which i would like to do on exit. Handdle cleanup in the destructor of the dialog if possible. If you need to, you can also use the destructor for the app, or even OnExitInstance. ------- sig starts "I've heard some drivers saying, 'We're going too fast here...'. If you're not here to race, go the hell home - don't come here and grumble about going too fast. Why don't you tie a kerosene rag around your ankles so the ants won't climb up and eat your candy ass..." - Dale Earnhardt "...the staggering layers of obscenity in your statement make it a work of art on so many levels." - Jason Jystad, 10/26/2001

        A Offline
        A Offline
        ask_you
        wrote on last edited by
        #3

        1. i do not have any OK button in my application. so can any1 suggest how to handle the event on pressing the ENTER command.. 2. i tried to enter clean-up in the destructor. it doesn't work:( I don't know about OnExitInstance. Can u elaborate?

        realJSOPR V D 3 Replies Last reply
        0
        • A ask_you

          1. i do not have any OK button in my application. so can any1 suggest how to handle the event on pressing the ENTER command.. 2. i tried to enter clean-up in the destructor. it doesn't work:( I don't know about OnExitInstance. Can u elaborate?

          realJSOPR Offline
          realJSOPR Offline
          realJSOP
          wrote on last edited by
          #4

          Well, you haven't even described your application, so how the hell can I (or anyone) help you? WHY does your program close down when you press ENTER? One final note - show us some freakin respect and SPELL everything out. You're not texting over a goddamn phone, so "any1" and "u" are not acceptable and only serve to annoy the literate members of this board. ------- sig starts "I've heard some drivers saying, 'We're going too fast here...'. If you're not here to race, go the hell home - don't come here and grumble about going too fast. Why don't you tie a kerosene rag around your ankles so the ants won't climb up and eat your candy ass..." - Dale Earnhardt "...the staggering layers of obscenity in your statement make it a work of art on so many levels." - Jason Jystad, 10/26/2001

          A 1 Reply Last reply
          0
          • A ask_you

            1. i do not have any OK button in my application. so can any1 suggest how to handle the event on pressing the ENTER command.. 2. i tried to enter clean-up in the destructor. it doesn't work:( I don't know about OnExitInstance. Can u elaborate?

            V Offline
            V Offline
            V 0
            wrote on last edited by
            #5

            Is it dialog based? Then you probably deleted the OK and CANCEL button of the resources? Override the OnOK function (and leave it empty if it doesn't need to do something) If it fails try also overriding the OnCancel function. hope it helps. "If I don't see you in this world, I'll see you in the next one... and don't be late." ~ Jimi Hendrix

            A 1 Reply Last reply
            0
            • realJSOPR realJSOP

              Well, you haven't even described your application, so how the hell can I (or anyone) help you? WHY does your program close down when you press ENTER? One final note - show us some freakin respect and SPELL everything out. You're not texting over a goddamn phone, so "any1" and "u" are not acceptable and only serve to annoy the literate members of this board. ------- sig starts "I've heard some drivers saying, 'We're going too fast here...'. If you're not here to race, go the hell home - don't come here and grumble about going too fast. Why don't you tie a kerosene rag around your ankles so the ants won't climb up and eat your candy ass..." - Dale Earnhardt "...the staggering layers of obscenity in your statement make it a work of art on so many levels." - Jason Jystad, 10/26/2001

              A Offline
              A Offline
              ask_you
              wrote on last edited by
              #6

              there is nothing much to speak out. its a dialog based app without any OK. The application minimizes to the tray when i click on the close. In the tray when it is minimized, i create a pop-up menu on right-clicking the icon. From this menu i exit..... Now, my application closes on pressing ENTER. if i knew why it closes, i would not have posted a message in this forum. My intention was never to annoy literate members in this board... ask_you

              1 Reply Last reply
              0
              • V V 0

                Is it dialog based? Then you probably deleted the OK and CANCEL button of the resources? Override the OnOK function (and leave it empty if it doesn't need to do something) If it fails try also overriding the OnCancel function. hope it helps. "If I don't see you in this world, I'll see you in the next one... and don't be late." ~ Jimi Hendrix

                A Offline
                A Offline
                ask_you
                wrote on last edited by
                #7

                Thanx V. I had removed the OK button from the dialog box.. but its implementation remained!!! I commented it. it worked... thanx but my other question remains... how to handle the event in my when someone does end process from the task manager.. Is it possible to handle??

                V 1 Reply Last reply
                0
                • A ask_you

                  Thanx V. I had removed the OK button from the dialog box.. but its implementation remained!!! I commented it. it worked... thanx but my other question remains... how to handle the event in my when someone does end process from the task manager.. Is it possible to handle??

                  V Offline
                  V Offline
                  V 0
                  wrote on last edited by
                  #8

                  ask_you wrote: I had removed the OK button from the dialog box.. but its implementation remained!!! ==> MICROSOFT :laugh: ask_you wrote: how to handle the event in my when someone does end process from the task manager.. Is it possible to handle?? Destructor/Dispose I think I wouldn't know. sorry. "If I don't see you in this world, I'll see you in the next one... and don't be late." ~ Jimi Hendrix

                  1 Reply Last reply
                  0
                  • A ask_you

                    1. i do not have any OK button in my application. so can any1 suggest how to handle the event on pressing the ENTER command.. 2. i tried to enter clean-up in the destructor. it doesn't work:( I don't know about OnExitInstance. Can u elaborate?

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

                    ask_you wrote: 1. i do not have any OK button in my application. So is it a dialog-based application or not? ask_you wrote: 2. i tried to enter clean-up in the destructor. it doesn't work Which object's destructor? ask_you wrote: I don't know about OnExitInstance. Can u elaborate? See here.


                    "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
                    • A ask_you

                      Firstly, the application that i developed closes forcibly when i press ENTER. which event should i handle so that the the application does respond to ENTER command. Secondly, from the task manager when i select my application and do end process, the application closes forcibly. Which event should i handle in these case so that my app does some clean-up operation which i would like to do on exit. ask_you

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

                      ask_you wrote: Secondly, from the task manager when i select my application and do end process, the application closes forcibly. Which event should i handle in these case so that my app does some clean-up operation which i would like to do on exit. I'm half-surprised that when killing an application with the task manager it does not go thrue the exitinstance method !?!?! maybe have a look at signal and handle SIGTERM


                      Maximilien Lincourt Your Head A Splode - Strong Bad

                      realJSOPR 1 Reply Last reply
                      0
                      • M Maximilien

                        ask_you wrote: Secondly, from the task manager when i select my application and do end process, the application closes forcibly. Which event should i handle in these case so that my app does some clean-up operation which i would like to do on exit. I'm half-surprised that when killing an application with the task manager it does not go thrue the exitinstance method !?!?! maybe have a look at signal and handle SIGTERM


                        Maximilien Lincourt Your Head A Splode - Strong Bad

                        realJSOPR Offline
                        realJSOPR Offline
                        realJSOP
                        wrote on last edited by
                        #11

                        Did you see that he said "end the process"? There's two ways to stop an app in task manager, and he implies that he's using the "End Process" button on the Processes tab. When you do that, Task Manager displays a warning that this is a last-resort method for shutting an app down because it DOES NOT DO CLEANUP. His app is probably freezing up tighter than a 40-year-old virgin, forcing him to use End Process on it. If the original poster was better at communication, this thread wouldn't be as long as it is, and he would at least be looking for the real problem instead of trying to hide it by trying to fudge in some clean-up code. ------- sig starts "I've heard some drivers saying, 'We're going too fast here...'. If you're not here to race, go the hell home - don't come here and grumble about going too fast. Why don't you tie a kerosene rag around your ankles so the ants won't climb up and eat your candy ass..." - Dale Earnhardt "...the staggering layers of obscenity in your statement make it a work of art on so many levels." - Jason Jystad, 10/26/2001

                        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