让每一个浏览器窗口的用C#的路径 [英] Get the path of every explorer window with c#
问题描述
我很新的C#。
我很无聊,有时我关闭一个窗口,几秒钟后,我注意到,我又需要一个窗口,是很无奈的对我重新打开Windows资源管理器,然后定位到特定的路径。
所以,我想创建一个小应用程序,允许我存储最后的名单关闭的窗口。并配有快捷键恢复逐个最后一个关闭的窗口(就像我做喜欢Firefox浏览器),并与其他主要shorcut显示与过去的N个窗口的列表。
我不知道如何获得Windows的路径和重要的是,该方案也得到了时变路径(当用户导航)。
谢谢寻求帮助。
我会后一旦应用程序将完成的链接。
< DIV CLASS =h2_lin>解决方案
从的这里:
SHDocVw.ShellWindows shellWindows =新SHDocVw.ShellWindows();
字符串的文件名;
的foreach(SHDocVw.InternetExplorer即shellWindows)
{
=文件名Path.GetFileNameWithoutExtension(ie.FullName).ToLower();如果
(filename.Equals(资源管理器))
{
//保存位置,给您的应用程序
Console.WriteLine(资源管理器的位置:{ 0},ie.LocationURL);
//设置当用户导航
ie.NavigateComplete2 =新SHDocVw.DWebBrowserEvents2_NavigateComplete2EventHandler(handlerMethod)为一个触发器;
}
}
I'm very new with C#.
I was boring that sometimes I close a window and after few seconds I note that I need that window again, and is very frustrating to me to reopen Windows Explorer and navigate to that specific path.
So I want to create a little app that permits me store a list of the last closed windows. And with a key shortcut restore one by one the last closed windows (just like I do with browsers like Firefox) and with other key shorcut display a list with the last n windows.
I don't know how to get the paths of the windows and is important that the program gets also when the paths changed (when the user navigates).
Thanks for help.
I will post the link once the app will be finished.
Taken from here:
SHDocVw.ShellWindows shellWindows = new SHDocVw.ShellWindows();
string filename;
foreach ( SHDocVw.InternetExplorer ie in shellWindows )
{
filename = Path.GetFileNameWithoutExtension( ie.FullName ).ToLower();
if ( filename.Equals( "explorer" ) )
{
// Save the location off to your application
Console.WriteLine( "Explorer location : {0}", ie.LocationURL );
// Setup a trigger for when the user navigates
ie.NavigateComplete2 += new SHDocVw.DWebBrowserEvents2_NavigateComplete2EventHandler(handlerMethod);
}
}
这篇关于让每一个浏览器窗口的用C#的路径的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!