如何从公共控件对话框挂钩获取对 Win7 库的引用?
我正在实现 OFNHookProc
检测通用控件 GetOpenFileName()< Windows 7 上的 /code>
对话框。我的仪器是用 C++ 编写的。在用户选择库(如文档或图片)之前,一切都会正常工作。发生这种情况时,我会像预期的那样收到
CDN_FOLDERCHANGE
通知,但是当我向对话框发送 CDM_GETFOLDERPATH
消息以检索新选择的文件夹时,我收到错误返回 - 1,CommDlgExtendedError
返回 0。在某些方面,这是有道理的,因为它不是一个文件夹,但其他消息似乎都不起作用(例如 CDM_GETFOLDERIDLIST
或 <代码>CDM_GETFILEPATH)。
那么,如何从 OFNHookProc
判断当前选定的项目或文件夹是一个库?一旦您知道它是一个库,您如何获得它的 IShellItem
或 IShellLibrary
接口,以便您可以找出哪些文件系统文件夹构成了该库?
(创建 GetOpenFileName
对话框的代码是旧代码,因此我无法将其替换为 Windows-7 推荐的 IFileOpenDialog
界面,该界面以合理的方式支持库) 。
I am implementing an OFNHookProc
to instrument a common controls GetOpenFileName()
dialog on Windows 7. My instrumentation is written in C++. Things work fine until the user selects a Library (like Documents or Pictures). When this happens, I get the CDN_FOLDERCHANGE
notification like I expect, but when I send the dialog the CDM_GETFOLDERPATH
message to retrieve the newly selected folder, I get an error return of -1, with CommDlgExtendedError
returning 0. In some ways, this makes sense, since it's not a folder, but none of the other messages seem to work either (like CDM_GETFOLDERIDLIST
or CDM_GETFILEPATH
).
So, how do you tell from an OFNHookProc
that the currently selected item or folder is a library? Once you can tell that it's a library, how do you get an IShellItem
or IShellLibrary
interface to it such that you can figure out what file system folders constitute the library?
(The code that creates the GetOpenFileName
dialog is legacy code, so I can't replace it with the Windows-7-recommended IFileOpenDialog
interface that supports Libraries in a sane manner).
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论