[英]Using Windows API Code Pack can I get Windows Explorer AddresBar path?
I would like to know whether the Class Library of the Microsoft's Windows APi Code Pack
library provides a direct way to iterate the Windows Explorer instances to retrieve the current path of the address bar of each Explorer instance, in simple words, I need to get a list with all the paths that are open by Explorer.exe instances. 我想知道微软的
Windows APi Code Pack
库的类库是否提供一种直接方法来迭代Windows资源管理器实例以检索每个资源管理器实例的地址栏的当前路径,简单来说,我需要获取一个列出所有由Explorer.exe实例打开的路径。
This is the text which I would like to retrieve (from all running instances of explorer.exe) 这是我要检索的文本(从explorer.exe所有正在运行的实例中检索)
I don't know if this is possibly using Windows API Code Pack
then I do not have any code to demonstrate my progress (which is Zero), I'm just asking for information about this to procceed with a better investigation, but any kind of code example will be very appreciated. 我不知道这是否可能使用
Windows API Code Pack
然后我没有任何代码来演示我的进度(为零),我只是想获取有关此信息以进行更好的调查,但无论如何代码示例非常感谢。
If Windows API Code Pack
can't help in the task, what alternatives I have to realize this? 如果
Windows API Code Pack
无法完成任务,那么我必须采取哪些替代措施? maybe Microsoft UI automation
? 也许是
Microsoft UI automation
?
PS: I doscovered the way to retrieve it using the interop Microsoft Internet Controls
, the solution is explained in this url , but I'm really interested into learn how to do it using Windows API Code Pack
PS:我发现了使用互操作
Microsoft Internet Controls
检索它的方法,该解决方案在此url中进行了解释,但是我真的很想学习如何使用Windows API Code Pack
来进行检索。
This will get you most of the way there, First, add reference for Microsoft Shell Controls and Automation
and Microsoft Internet Controls
from the COM tab in Project -> References 这将为您提供大部分帮助,首先,从“ 项目”->“参考”中的 “ COM”选项卡添加
Microsoft Shell Controls and Automation
以及Microsoft Internet Controls
的参考。
Imports Shell32
Private exList As New List(Of String) '
Private Sub Button2_Click(sender As Object, e As EventArgs) Handles Button2.Click
Dim exShell As New Shell
exList.Clear()
For Each win As ShellBrowserWindow In DirectCast(exShell.Windows, IShellWindows)
thisPath = ""
If TryCast(win.Document, IShellFolderViewDual) IsNot Nothing Then
thisPath = DirectCast(win.Document, IShellFolderViewDual).FocusedItem.Path
ElseIf TryCast(win.Document, ShellFolderView) IsNot Nothing Then
thisPath = DirectCast(win.Document, ShellFolderView).FocusedItem.Path
End If
If String.IsNullOrEmpty(thisPath) = False Then
ExplorerFiles.Add(thisPath)
End If
Next
End Sub
Test output: 测试输出:
C:\Temp\_test
M:\Books - Non Fiction\Crusades - Iron Men and Saints\01 Iron Men and Saints.mp3
G:\_Video\_Movies
Sometimes it also seems to report the first item is selected. 有时似乎还会报告选择的第一项。 This might be a better way
这可能是更好的方法
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.