用c#获取每个资源管理器窗口的路径(Get the path of every explorer window with c#)

编程入门 行业动态 更新时间:2024-10-23 07:26:14
用c#获取每个资源管理器窗口的路径(Get the path of every explorer window with c#)

我对C#非常陌生。

我很无聊,有时我关闭了一个窗口,几秒钟后我注意到我再次需要这个窗口,并且对我重新打开Windows资源管理器并导航到特定路径感到非常沮丧。

所以我想创建一个小应用程序,允许我存储最后关闭的窗口列表。 并且通过按键快捷方式逐个还原最后一个关闭的窗口(就像我使用Firefox这样的浏览器)并用其他关键快捷方式显示最后一个窗口的列表。

我不知道如何获得窗口的路径,并且程序在路径改变时(用户导航时)也很重要。

感谢帮助。


我将在应用程序完成后发布链接。

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.

最满意答案

采取从这里 :

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); } }

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); } }

更多推荐

本文发布于:2023-08-04 05:47:00,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1409400.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:资源管理器   路径   窗口   window   path

发布评论

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

>www.elefans.com

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