I want to get the Handle of my "Windows Explorer" Windows (not Internet Explorer).
Normally it works with
var processes = Process.GetProcesses();
foreach (var process in processes)
{
var handle = process.Handle;
}
What i want to do is following:
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
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.
Or can somebody explain me why the "Windows Explorer" is different from other Programms?
Point well taken, so let me try to explain briefly what the code does - you can read more about the ShellWindows object here. 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").
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());
}
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With