了解编程如果一个进程正在要求用户输入 [英] Find out programmatically if a process is demanding user input
问题描述
我如何编程(在C#)确定,如果另一个外国申请(本机,JAVA,.NET或任何...)目前要求苛刻的用户输入?这能在托管code完全做呢?
How can I programmatically (in C#) determine, if ANOTHER foreign application (native, java, .NET or whatever...) is currently demanding user input? Can this be done fully in Managed code?
我正在寻找的是执行:
static Boolean IsWaitingForUserInput(String processName)
{
???
}
通过要求用户输入我的意思是当一个应用程序要求用户输入一些数据或退出的错误消息(模式对话框),并不能再执行正常任务。正在等待用户绘制一些绘图应用程序是不是在这里的意思。
By demanding user input I mean when an application asks the user to enter some data or quit an error message (Modal dialogs) and is not able to perform its normal tasks anymore. A drawing application that is waiting for the user to draw something is not meant here.
PS:经过修改,以反映在底部的意见,并做出更清楚的关注,一些意见和答案可能不是100%的问题是一致的。评价答案和言论时考虑到这一点。
PS: After edits to reflect the comments at the bottom and make the concern clearer, some comments and answers may not be 100% consistent with the question. Take this into account when evaluating the answers and remarks.
推荐答案
这一般是不可能的。就拿常见的一种应用,字处理器。如今将在后台运行spellchecks,它会定期自动保存您的文档,等等。然而,从用户的角度来看,它在等待输入所有的时间。
It's in general impossible. Take for instance a common kind of application, a word processor. Nowadays that will be running spellchecks in the background, it periodically auto-saves your document, etcetera. Yet from a users perspective it's waiting for input all the time.
另一种常见的情况是一个幻灯片浏览器。在任何时刻,你可以preSS一键前进的幻灯片。然而,你的普通用户也不会认为这是等待输入
Another common case would be a slideshow viewer. At any moment in time you could press a key to advance a slide. Yet your typical user would not view this as "waiting for input".
要概括:等待输入是一个主观状态,因此不能以编程确定
To summarize: "waiting for input" is a subjective state and therefore cannot be determined programmatically.
这篇关于了解编程如果一个进程正在要求用户输入的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!