打开"Internet属性",然后等待用户将其关闭C# [英] Open Internet Properties and wait until user close it C#
问题描述
是否有可能打开"Internet属性"窗口..
代码:
Is there any possibility to open Internet Properties window..
Code:
System.Diagnostics.Process p;
p = System.Diagnostics.Process.Start("InetCpl.Cpl", ",4");
.. 并等到用户将其关闭?(然后检查互联网连接并继续)
..and wait until user close it? (and then check internet connection and continue)
此代码不起作用:
p.WaitForExit();
我认为此问题与打开资源管理器窗口和等待它关闭,但是针对此问题的解决方案仅包含Windows资源管理器浏览器窗口特有的提示.
I think this problem is related to Open explorer window and wait for it to close but solution for this contains only tips specific for windows explorer browser window.
我可以在C#中执行此操作吗?
Can I do this in C#?
解决方案
有人在这里(仅一小会儿)将这个完整命令如何打开"Internet属性"窗口:
Solution
Someone put here (only for a short moment) this full command how to open Internet Properties window:
C:\Windows\system32\rundll32.exe C:\Windows\system32\shell32.dll,Control_RunDLL C:\Windows\system32\inetcpl.cpl,,4
我尝试了..真的.. 它有效!
I tried it .. and really .. it works!
System.Diagnostics.Process p;
p = System.Diagnostics.Process.Start("rundll32.exe",
@"C:\Windows\system32\shell32.dll,Control_RunDLL"
+ " C:\Windows\system32\inetcpl.cpl,,4");
p.WaitForExit();
MessageBox.Show("Properties closed");
仅在关闭属性"窗口后,才会显示属性已关闭"消息.
无需PID ..简单完美的解决方案.
如果使用此命令编写原始响应的用户再次将其写入,则我接受他的解决方案.
I get "Properties closed" message only after I close Properties window.
No PID needed .. easy and perfectly elegant solution.
If the user that wrote the original response with this command write it again, I accept his solution.
推荐答案
使用以下代码在单独的过程中打开控制面板:
Use the below Code to open control panel in separate process:
System.Diagnostics.Process.Start(@"C:\Windows\system32\rundll32.exe"
, @"C:\Windows\system32\shell32.dll,Control_RunDLL"
+ " C:\Windows\system32\inetcpl.cpl,,4");
然后您可以WaitForExit();
这篇关于打开"Internet属性",然后等待用户将其关闭C#的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!