获取Windows资源管理器的进程句柄

编程入门 行业动态 更新时间:2024-10-27 14:23:47
本文介绍了获取Windows资源管理器的进程句柄的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我要得到我的Windows资源管理器窗口(不是Internet Explorer)的句柄。

I want to get the Handle of my "Windows Explorer" Windows (not Internet Explorer).

通常情况下它与

var processes = Process.GetProcesses(); foreach (var process in processes) { var handle = process.Handle; }

我想什么做的是以下内容:

带上一个特定的浏览器窗口,以前景。 我已经实现了ToForeGround方法并能正常工作的所有其他窗口,除了Windows资源管理器

Bring the a specific Explorer Window to ForeGround. I have implemented the "ToForeGround" Method and it works fine for all other Windows except the Windows Explorer

但与Windows资源管理器,我只拿到的过程多少的Windows任务栏上的独立是开放的,只有一个Windows资源管理器的过程。

But with the Windows Explorer i only get the Process of the Taskbar independent of how much Windows are open, there is only one "Windows Explorer" Process.

或者有人可以解释我为什么在Windows资源管理器,是有别于其他programms的

Or can somebody explain me why the "Windows Explorer" is different from other Programms?

推荐答案

点以及采取的,所以让我尽量简明扼要地解释代码不? - 你可以阅读更多关于ShellWindows这里对象的http:// MSDN。 microsoft/en-us/library/windows/desktop/bb773974(v=vs.85).aspx

Point well taken, so let me try to explain briefly what the code does - you can read more about the ShellWindows object here msdn.microsoft/en-us/library/windows/desktop/bb773974(v=vs.85).aspx

下面的代码可以帮助你找到所有Windows资源管理器的运行实例(不是Internet Explorer,请注意,资源管理器中使用if语句,而不是IEXPLORE)。

The code below helps you find all running instances of Windows Explorer (not Internet Explorer, note that "explorer" is used in the if statement and not "iexplore").

添加引用的Shell32.dll,位于Windows / system32文件夹下

Add Reference to Shell32.dll, located in the Windows/system32 folder

SHDocVw.ShellWindows shellWindows = new SHDocVw.ShellWindows(); string filename; ArrayList windows = new ArrayList(); foreach (SHDocVw.InternetExplorer ie in shellWindows) { filename = Path.GetFileNameWithoutExtension(ie.FullName).ToLower(); if (filename.Equals("explorer")) { //do something with the handle here MessageBox.Show(ie.HWND.ToString()); } }

更多推荐

获取Windows资源管理器的进程句柄

本文发布于:2023-11-03 19:54:14,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1555941.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:句柄   资源管理器   进程   Windows

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!