我有一个在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.
更多推荐
发布评论