【发布时间】:2015-11-20 12:32:03
【问题描述】:
我正在使用以下代码,以便当用户单击按钮时,Windows Explorer 的实例会在特定路径中打开。但这会导致 Explorer 的新实例被打开。
我想更改它,如果 Explorer 已经在同一路径中打开,则程序不会创建新进程而是将打开的实例置于前面。
private void button_Click(object sender, EventArgs e)
{
if (Directory.Exists(myPath))
Process filesFolder = Process.Start("explorer.exe", Conf.FilesLocation);
}
【问题讨论】:
-
然后不启动一个新实例,找到现有的窗口并将其带到前台
-
@PanagiotisKanavos 这就是问题所在。我怎么知道它是否已经打开?
-
@disasterkid,看看我的回答是否已经打开。
标签: c# process windows-explorer