I have a program that when I click a button, it starts doing certain manipulations in the browser, i.e. click, drive a mouse, etc. But since the program clicks, the form itself is in an inactive state. To close the program, I tried to make a hook and catch this click and then close it, but it does not always work, and even if it works, the form closes and the program itself (I looked in the task manager, at this moment it is in the background ) continues to perform several actions and only when it completes them closes. Is there any more certain way that could at once end the execution of all scripts and close the program? (If it is possible to make the program stop clicking, but did not close even better) I used Applicaton.Exit() as the code to close the program.
- oneIt seems I have already seen this question - Pavel Mayorov
- GetCurrentProcess + TerminateProcess try - Vladimir Martyanov
- Well, do support cancellation. For example, distribute a complete CancellationToken to all parts of the program. For this, it is invented. Or you can start the work in a separate Thread and you can kill it, if you really want so much to force it all to be forced. - vitidev
|