我自己的方法打开选定的进程的文件位置,效果如图:
系统的任务管理器,打开同一进程文件位置,效果如下:请问,怎样才能实现像系统的任务管理器一样的功能,打开文件位置的文件夹后自动选定对应的文件呢?
希望能给出实例代码,我会自行研究,谢谢!

解决方案 »

  1.   

    Explorer [/n] [/e] [(,)/root,<object>] [/select,<object>]/n                Opens a new single-pane window for the default
                      selection. This is usually the root of the drive Windows
                       is installed on. If the window is already open, a
                      duplicate opens./e                Opens Windows Explorer in its default view./root,<object>    Opens a window view of the specified object.
    /select,<object>  Opens a window view with the specified folder, file or
                      application selected.

      

  2.   

    补充一下,我实现这一功能的代码如下
    try
                {
                    string proName = listView1.SelectedItems[0].Text;
                    MessageBox.Show(proName);
                    string str;
                    Process p = Process.GetProcessById(Convert.ToInt32(proName)); //根据进程命获得指定的进程          {
                    MessageBox.Show(p.ProcessName);
                    str = p.MainModule.FileName;
                    Process.Start(str.Substring(0,str.LastIndexOf(@"\")));
                }
                catch (Exception ex)
                {
                    MessageBox.Show("获取进程路径出错,Error:" + ex.Message, "失败信息", MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
      

  3.   

    最后那句改成
    Process.Start("explorer.exe","/select," + str)
      

  4.   

    谢谢各位!
    caozhy 给出了原理,但是技术太菜了,一时半会儿没看明白;
    iyomumx 给出了应用的实例代码。
    我结合二位的答案,终于明白了,非常感谢,满意结贴。