简体   繁体   English

当我使用Process.Start()运行该程序时,如何强制另一个程序不显示任何对话框

[英]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. 取决于您正在运行的可执行文件,如果运气好的话,它可能会公开一个接受一些quietnoui参数的命令行版本,但这不太可能。

Or you could try programmatically closing those dialog boxes, as suggested. 或者,您可以按照建议尝试以编程方式关闭这些对话框。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 使用Process.Start()时,如何在程序运行期间保持cmd提示符打开? - When using Process.Start(), how can I keep the cmd prompt open for the duration of the program? 当我使用Process.Start运行python程序时,我的python程序中的日志不起作用吗? - When I run a python program using Process.Start the log in my python program does not work? 如何在继续之前强制Process.Start()完成? - How do I force Process.Start() to complete before proceeding? 如何使用Process.Start()通过Web服务在服务器端执行程序? - How can I use Process.Start() to execute program on the server-side via web service? 使用 Process.Start 时无法登录 Skype - Can't log to Skype when I use Process.Start 如何使用Process.Start启动管道并重定向命令? - How can I launch pipes and redirects commands with Process.Start? 如何从.NET程序打开Web浏览器? Process.Start()不起作用? - How do I open a web browser from a .NET Program? Process.Start() isn't working? 如何使用 c# 运行 exe 文件(我不能使用 Process.Start() 因为我不知道 exe 文件的位置) - How can I run an exe file with c# (I can't use Process.Start() because I don't know the exe file's location) 为什么我不能使用 Process.Start 启动 Robocopy - Why i can't launch Robocopy with Process.Start 如果我具有洪流的URL,如何使用Process.Start()“启动”它? - If I have the URL of a torrent, how can I just “launch” it using the Process.Start()?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM