如何以编程方式设置文件标签
当使用 Windows 资源管理器查看文件时,我可以选择设置“标签”、“类别”或其他属性。对于 JPEG,可以选择一组不同的属性(包括“标签”)。我希望能够以编程方式设置这些。
如何使用 Delphi 以编程方式设置文件标记和其他文件属性(我有 Delphi 2010 Pro)?
When using Windows Explorer to view files, I'm given the option to set a "tag", "category", or other attributes. For a JPEG a different set of attributes (including "tag") are options. I'd like to be able to set these programmatically.
How do I programmatically set a file tag and other file attributes using Delphi (I have Delphi 2010 Pro)?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
JPEG 文件中的标签存储为 IPTC 关键字。如果您需要的话,有一些库可用于阅读和编写这些内容。
资源管理器为不同的文件类型显示不同的列,因为它知道这些文件类型支持这些额外的列。您可以定义 shell 插件来支持您自己的文件类型的自定义列信息。 MSDN 提供了概述。
Tags in JPEG files are stored as IPTC keywords. There are a few libraries available for reading and writing those, if that's what you're asking for.
Explorer shows different columns for different file types because it knows that those file types support those extra columns. You can define shell plug-ins to support custom column information for your own file types. MSDN provides an overview.
我认为您想要检索可以在资源管理器中按鼠标右键访问的文件的所有属性。
您可以使用这个单元:
这不是我的代码,但我已经成功使用了它。效果很好。
要检索属性,您可以执行以下操作:
问候
Neftalí
I think that you want retrieve all properties of the file that can be accesed pressing right button on mouse in explorer.
You can use this unit:
This is not my code, but i have used it successfully. It work fine.
To retrieve properties you can do this:
Regards
Neftalí
我知道没有标准方法来存储附加元数据信息。每个应用程序都可以注册自己的属性选项卡,并可以以任何方式存储此元数据信息。
我相信您谈论的是 Windows 照片库的图像标记功能。
该信息存储在两个文件中: pictures.pd4 和 NavTree.state
由 Gail Bjork 确定想要删除此信息的人。
它存储在:C:\Users\YourUser\AppData\Local\Microsoft\Windows Photo Gallery。
有些人已经弄清楚了文件格式。但我还没有找到微软内部或外部任何人发布的规范。
您还询问了其他文件属性,这些属性可以通过
可设置的属性进行设置:
//以下将 test.txt 设置为只读和隐藏文件。
FileSetAttr('C:\Test.txt',faReadOnly 或 faHidden);
该函数确实有一个布尔结果,您可以检查该结果以了解操作是否成功完成。
I know of no standard way to store additional meta data information. Each application can register there own property tab and could store this meta data information in any way.
I believe your talking about the image tagging feature of Windows Photo Gallery.
The information is stored in two files: pictures.pd4 and NavTree.state
as determined by Gail Bjork person who wanted to remove this information.
This stored in: C:\Users\YourUser\AppData\Local\Microsoft\Windows Photo Gallery.
Some people have figured out the file format. But I have not found a published spec from anyone internal to Microsoft or external.
You also asked about other file attributes these can be set through the
Attributes that can be set:
//The following sets test.txt to a readonly and hidden file.
FileSetAttr('C:\Test.txt',faReadOnly or faHidden);
The function does have a boolean result that you can check to see if the operation completed successfully.
我现在正在开发一个标记应用程序,似乎最好的答案是 Windows Imaging Component API,它具有读取和写入各种图像格式(Exif、IPTC 等)元数据的实现。应该区分文件系统中文件的元数据和文件本身内的元数据——这是指后者。
Getty Images 也有一篇关于使用 WIC API 进行编程。
I'm developing a tagging application right now, and it seems that the best answer is the Windows Imaging Component API, which has implementations for reading and writing metadata for various image formats (Exif, IPTC, etc.). A distinction should be made between metadata for the file in the filesystem and metadata within the file itself--this is referencing the latter.
Getty Images also has a good article on programming with the WIC API.