使用C#强制关闭Windows CE 5应用 [英] Force close Windows CE 5 app using C#

查看:241
本文介绍了使用C#强制关闭Windows CE 5应用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我如何去强制关闭基于Windows CE 5.0的应用程序,使用C#?我已经尝试过 Application.Exit()但是,这并不总是杀死所有正在运行的线程。

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.

我通常会使用 Environment.Exit()但这不是在CF用,很遗憾。

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

推荐答案

这取决于您使用的CF的版本。 Application.Exit 是正确的机制,退出应用程序,但你的线程必须同时处理。在CF 2.0和3.5,在的IsBackground 属性设置为真正所有创建的线程(只是做在创建时) 。在CF 1.0,你必须手动添加一个标志到包含类,线程PROC着眼于周期性知道它是否应该退出。

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.

这篇关于使用C#强制关闭Windows CE 5应用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆