[英]How can I force another program to not show any dialog when I run it with Process.Start()
I'm not sure if it's possible anyway. 我不确定是否有可能。 But my question is, can I force a program to not show any dialogs when I run it with
process.Start()
? 但是我的问题是,当我使用
process.Start()
运行程序时,是否可以强制程序不显示任何对话框?
I have a program where I call another program in a foreach
loop. 我有一个程序,可以在
foreach
循环中调用另一个程序。 It is a fileconverter. 它是一个文件转换器。 Unfortunately some files don't exist any more or the user gives the wrong filepath.
不幸的是,某些文件不再存在,或者用户指定了错误的文件路径。 If that happens, the converter shows an error with a messagebox.
如果发生这种情况,转换器将显示一个错误消息框。 But i don't want to see that box, because if the user wants to convert 10000 files, but has the wrong path in settings, 10000 messagboxes appear and force the system to crash.
但我不想看到该框,因为如果用户要转换10000个文件,但设置中的路径错误,则会出现10000个消息框,并迫使系统崩溃。
I have tried to kill these processes but they have the same name in the processes as the converter itself. 我试图杀死这些进程,但它们在进程中的名称与转换器本身相同。 I can handle it with a
Thread.Sleep
but then my mouse is flickering all the time while my thread is running. 我可以使用
Thread.Sleep
处理它,但是当我的线程运行时,鼠标一直在闪烁。 This is just a little bit better than the messageboxes. 这仅比消息框好一点。
If there is a way, I would be very thankful if you could tell me :) 如果可以的话,如果您能告诉我,我将非常感激:)
Regards Schlinger 致谢林格
Most probably it's not possible. 很有可能是不可能的。 There is no built-in way to prevent any executable to show any dialog box.
没有阻止任何可执行文件显示任何对话框的内置方法。
Depending on the executable you're running, with some luck it might expose a command line version that accepts some quiet
or noui
parameter, but it's unlikely. 取决于您正在运行的可执行文件,如果运气好的话,它可能会公开一个接受一些
quiet
或noui
参数的命令行版本,但这不太可能。
Or you could try programmatically closing those dialog boxes, as suggested. 或者,您可以按照建议尝试以编程方式关闭这些对话框。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.