获取Windows窗体资源管理器过程 [英] Get the windows form explorer process
本文介绍了获取Windows窗体资源管理器过程的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
好的.我一直在寻找可以检索所有打开的窗口的代码,但是发现的所有内容都使用winAPI函数,并且此代码
Ok. I was looking for a code that can retrive me all open windows, but all I have found was using winAPI functions and this code
foreach (Process p in Process.GetProcesses(System.Environment.MachineName))
{
if (p.MainWindowHandle != IntPtr.Zero)
p.Kill();
}
好吧,它可以工作,但是它不会向我显示资源管理器的窗口,有什么方法可以使用类似类似代码的代码来显示资源管理器的窗口,而无需使用WinAPI?
Well, it works but it don''t show me the explorer''s windows, there''s any way for showing the explorer''s windows using code like a similar code like that one without using the WinAPI?
推荐答案
使用GetProcessesByName
foreach (Process p in Process.GetProcessesByName("explorer"))
{
//p.Kill();
}
为什么要杀死资源管理器?!
Why you want to kill explorer?!!
与当前用户交易更安全,也更易于控制. Codeproject上有一篇不错的文章.
如何获取流程所有者ID和当前用户SID [
Dealing with the current user is more secure as well as more easy to control. Codeproject has a nice article on that.
How To Get Process Owner ID and Current User SID[^]
您是否曾尝试删除资源管理器进程?它将删除系统托盘,开始"菜单...
不安全的破坏行为!不要这样做!
—SA
Did you ever try to remove Explorer process? It would remove system tray, "Start" meny…
Unsafe vandalizing practice! Don''t do it!
—SA
这篇关于获取Windows窗体资源管理器过程的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文