“不响应”在新进程中运行时的窗口标题 [英] "Not Responding" in window title when running in new process

查看:198
本文介绍了“不响应”在新进程中运行时的窗口标题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个长时间运行的方法,必须在UI线程上运行。(Devex - gridView.CopyToClipboard()

I have a long running method that must run on UI thread. (Devex - gridView.CopyToClipboard())

我不需要在复制时响应UI,我添加了一个启动屏幕,所以用户不感到无聊。

I do not need the UI to be responsive while copying and I added a splash screen so the user isn't bored out of his mind.

当我运行这个程序一切都很好。

When I run this program all is well.

当我运行一个不同的程序,然后又启动一个新的进程并运行程序时,麻烦开始。
经过几秒钟的复制,标题读取(Not Responding),鼠标光标显示为忙,它当然会在几秒钟内清除,但是我想摆脱它,因为它给了用户误解感觉程序有问题。

Trouble starts when I run a different program which in turn starts a new process and runs the program on it. After a few seconds of copying the title reads (Not Responding) and the mouse cursor shows busy, it of course clears up within a few seconds but I'd like to get rid of it since it gives the user the misconstrued feeling that the program is faulty.

有没有办法设置我创建的进程的超时?

Is there any way to set the "Time out" of a process I create?

编辑:

主程序调用以下代码:

fillsProcess = new Process();
fillsProcess.StartInfo.FileName = Application.ExecutablePath;
fillsProcess.Start();

在fillsProcess中,当点击某个按钮时调用以下代码:

In the fillsProcess, when a certain button is clicked the following code is called:

gridViewToCopy.CopyToClipboard();

这行代码需要一段时间才能处理,几秒钟后,fillsProcess的窗口看起来没有反应因为这种方法在UI线程上运行。

This line of code takes a while to process and after a few seconds the window of the fillsProcess looks unresponsive since this method runs on the UI thread..

编辑第二:

显然(真的很可以理解)

Apparently (and really quite understandably)

gridViewToCopy.CopyToClipboard();

不是导致此问题的唯一方法。许多Devex方法必须在UI线程上运行(例如数据排序,数据过滤)

Is not the only method causing this problem. Many Devex methods have to run on UI thread (e.g. Sorting of data, Filtering of data)

所以感谢任何提供特定解决方案的人(工作或没有)但是我的原始问题再次弹出来:

So thanks to anyone who offered specific solution (that either worked or didn't) but my original question pops right back up again:

有没有办法更改超时时间或以某种方式控制整个不响应的失败?

推荐答案

您可以使用 DisableProcessWindowsGhosting win32函数:

You can use DisableProcessWindowsGhosting win32 function:

[DllImport("user32.dll")]
public static extern void DisableProcessWindowsGhosting();

这实际上并不能防止窗口冻结,而是阻止窗口中的Not Respongind文本标题。

This actually doesn't prevent the window from freezing, but prevents the "Not Respongind" text in the title.

这篇关于“不响应”在新进程中运行时的窗口标题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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