Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Force close Windows CE 5 app using C#

How do I go about force-closing an application on Windows CE 5.0, using C#? I've already tried Application.Exit() but this doesn't always kill all currently running threads.

I'd normally use Environment.Exit() but this is not available in CF, unfortunately.


1 Answers

It depends on the version of the CF you're using. Application.Exit is the correct mechanism to exit the app, but your threads have to be handled as well. In CF 2.0 and 3.5, set the IsBackground property to true on all created threads (just do it at creation time). On CF 1.0, you have to manually add a flag into the containing class that the thread proc looks at periodically to know if it should exit.

like image 138
ctacke Avatar answered Dec 08 '25 20:12

ctacke



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!