windows ce应用程序打开和关闭(windows ce application opening and closing)

编程入门 行业动态 更新时间:2024-10-27 20:39:41
windows ce应用程序打开和关闭(windows ce application opening and closing)

我有一个在Visual Studio 2008中创建的Windows CE 5.0中的程序。打开我创建的应用程序工作正常,但当我关闭应用程序时:

Application.Exit()

我无法打开另一个应用程序,我甚至无法再次打开相同的应用程序。

知道如何正确关闭程序吗? 我也试过用

Me.Close()

要么

Environment.Exit()

I have a program in Windows CE 5.0 created in Visual Studio 2008. Opening the application I created works fine but when I close the application with:

Application.Exit()

I cannot open another application, I cannot even open the same application again.

Any idea what about closing the program properly? I have also tried using

Me.Close()

or

Environment.Exit()

最满意答案

无法打开另一个应用程序,我甚至无法再次打开相同的应用程序。

看起来你的应用程序没有退出并“阻止”GUI。 或者上面究竟是什么意思? 可以单击开始按钮并打开菜单吗?

如果您的应用使用后台线程,则应用程序将无法正确关闭,直到这些线程也被终止。 您将使应用程序仍在进程列表中但没有GUI,应用程序似乎已终止但它没有。

如果您有后台线程,则必须在退出应用程序之前终止它们。

可以使用Thread.Abort()或使用while循环中的条件终止后台线程。 对于thread.avort,您必须在try / Catch块中编写后台线程的行,并捕获ThreadAbortException。

cannot open another application, I cannot even open the same application again.

Looks like your application does not exit and 'blocks' the GUI. Or what exactly does the above mean? Can click the start button and a menu opens?

If your app uses background thread, the app will not close correctly until these threads are terminated too. You will have the app still in the process list but no GUI, the app seem to have terminated but it did not.

If you have background threads you have to terminate them BEFORE you Exit the application.

Background threads can be terminated using Thread.Abort() or using a condition in a while loop. For the thread.avort you have to code the lines of the background thread within a try/Catch block and catch for the ThreadAbortException.

更多推荐

本文发布于:2023-07-21 09:26:00,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1208959.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:应用程序   ce   windows   closing   opening

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!