如何关闭Windows Search Explorer ... [英] How to close Windows Search Explorer...

查看:127
本文介绍了如何关闭Windows Search Explorer ...的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

亲爱的所有人,

我正在制作Windows桌面应用程序.我面临的问题是我已使用以下命令以编程方式打开Windows资源管理器:

Dear All,

I am making a windows desktop application. The problem I am facing is that I had opened windows explorer programatically using following command:

System.Diagnostics.Process.Start("Explorer.exe",@"c:\" + LearnerID );


我将在该特定位置搜索特定文件.
我想以编程方式关闭资源管理器.

我正在使用:


I will search for specific file in that particular location.
and I want to close the explorer programatically.

I am using:

KillProcessByUserName("explorer.exe", Environment.UserName);


函数来关闭该特定的资源管理器.
但是问题是搜索浏览器不会关闭.我想知道如何关闭该搜索窗口浏览器.

任何形式的链接,建议和特别的专家建议都将受到高度赞赏.

谢谢&问候
Balkrishna Raut


function to close that particular explorer.
but the problem is that the search explorer will not get closed. I would like to know how to close that search window explorer.

Any kind of link, suggestion and specially expert advice would be highly appreciated.

Thanks & Regards
Balkrishna Raut

推荐答案

进行此类工作时,请参见基本思想是首先获取要打开的应用程序的句柄.当您必须关闭应用程序时,将使用相同的句柄(在打开时存储的句柄)将其关闭.

代码帮助:

See the basic idea while doing this kind of work is to get the handle of the application first which you are going to open. When you have to close the application you will use the same handle (that you stored before while opening) to close it.

Code help:

string processName = "Process1";

foreach (Process proc in Process.GetProcessesByName(processName))
      proc.Kill();



参考链接:

http://dotnetperls.com/kill [ ^ ]



http://www.c-sharpcorner.com/UploadFile/scottlysle/ProcessKillCSharp04302008060422AM/ProcessKillCSharp.aspx [ ^ ]



Links for reference:

http://dotnetperls.com/kill[^]

or

http://www.c-sharpcorner.com/UploadFile/scottlysle/ProcessKillCSharp04302008060422AM/ProcessKillCSharp.aspx[^]




保留Process对象以供进一步使用.

Process TestPro = System.Diagnostics.Process.Start("Explorer.exe",@"c:\" + LearnerID);

使用TestPro对象,您可以获取其进程ID,该ID可用于杀死进程或仅制作带有进程对象及其ID的字典.

Process.GetProcessById();
Hi,

Keep Process object for further use.

Process TestPro=System.Diagnostics.Process.Start("Explorer.exe",@"c:\" + LearnerID );

With TestPro object you can get its process id by that can be use for killing process or just make a dictionary with process object and its id.

Process.GetProcessById();


这篇关于如何关闭Windows Search Explorer ...的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆