如何获得在Windows资源管理器窗口的完整路径 [英] How to get full path of a window in Windows Explorer

查看:457
本文介绍了如何获得在Windows资源管理器窗口的完整路径的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我不得不打开 Windows资源管理器的文件夹(例如 D:\\ MyFolder文件\\测试),我使用 :: GetForegroundWindow()来获得它的窗口句柄,并使用 :: GetWindowText时来获取标题文本。但在默认窗口不显示当前窗口的完整路径(当然你也可以通过工具 - 文件夹选项 - 查看 - 显示完整路径的标题栏来设定标题栏中显示完整路径),以及 :: GetWindowText时只得到测试。如果我想要得到的完整路径 D:\\ MyFolder文件\\测试我如何通过窗户得到这个句柄 ::得了GetForegroundWindow()

When I have to open a folder in Windows Explorer (for example d:\myfolder\test), I use ::GetForegroundWindow() to get its Window Handle, and use ::GetWindowText to get the Title Text. But in the default windows the full path of the current window is not displayed (of course you can through tools-folder option-view-display full path in title bar to set the title bar to display full path), and the ::GetWindowText only gets test. If I want to get the full path d:\myfolder\test how can I get this by the windows handle got by ::GetForegroundWindow() ?

任何建议。谢谢你。

推荐答案

通过使用的 ShellWindows COM对象。请参见这个例子就如何得到的文件夹该资源管理器窗口中查看。

By using the ShellWindows COM object. See this example on how the get the folder that an Explorer window is viewing.

这篇关于如何获得在Windows资源管理器窗口的完整路径的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆