There is a program that, when started, begins to perform many different functions, and the cursor starts moving across the entire screen, if the program is closed through the cross, it still continues to work and drag the cursor across the screen, how can you completely stop the program?
Closed due to the fact that the essence of the question is not clear to the participants aleksandr barakin , Mirdin , tutankhamun , Streletz , cheops 8 Sep '16 at 7:10 .
Try to write more detailed questions. To get an answer, explain what exactly you see the problem, how to reproduce it, what you want to get as a result, etc. Give an example that clearly demonstrates the problem. If the question can be reformulated according to the rules set out in the certificate , edit it .
- From the question it is not at all clear: are you trying to close the program from the inside, from its own code? Or do you need to close another application? - Nick Volynkin ♦
|
2 answers
Application.exit()
Tells all message consumers that they should complete, and then closes all application windows after the messages have been processed.
- And if the program is in an inactive state, how can it be closed with a button? - Alexander
- Alexander, what button? Hang the method on the event you need and that's it. - justyx
- They do not work when the form is minimized or inactive - Alexander
- Alexander, let's define the task, the question was how can the program be stopped? - justyx
- How to close you told. Your task now is to hang a timer or some other condition that will execute the above code. A softer output (if this is the main form) is still
this.Close(). - GRUNGER
|
As an option, try:
Process.Kill(); |