Force close Windows CE 5 app using C#

旧城冷巷雨未停 提交于 2019-12-01 06:43:32

问题


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:


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.



来源:https://stackoverflow.com/questions/15967894/force-close-windows-ce-5-app-using-c-sharp

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!