Anonymous
Файл Windows добавляет метаданные тега
Сообщение
Anonymous » 24 окт 2025, 05:53
Используя этот ответ, я включил документ Office, например метаданные, для файлов .pdf.
Теперь у меня есть такая панель сведений о Windows:
И Теги, которые я туда добавляю, отображаются в столбце "Теги" в подробном представлении Проводника.
Раньше у меня был такой код:
Код: Выделить всё
#include
#include
#include
#include
#include
#include
#pragma comment(lib, "Ole32.lib")
#pragma comment(lib, "Propsys.lib")
// Common property keys manually defined (from propkey.h)
const PROPERTYKEY PKEY_Title =
{ {0xf29f85e0, 0x4ff9, 0x1068,{0xab,0x91,0x08,0x00,0x2b,0x27,0xb3,0xd9}}, 2 };
const PROPERTYKEY PKEY_Author =
{ {0xf29f85e0, 0x4ff9, 0x1068,{0xab,0x91,0x08,0x00,0x2b,0x27,0xb3,0xd9}}, 4 };
const PROPERTYKEY PKEY_Keywords =
{ {0xd5cdd505, 0x2e9c, 0x101b,{0x93,0x97,0x08,0x00,0x2b,0x2c,0xf9,0xae}}, 5 };
const PROPERTYKEY PKEY_Tags = PKEY_Keywords; // alias
// Map key name (string) → PROPERTYKEY
bool GetPropertyKey(const std::wstring &name, PROPERTYKEY &key)
{
if (_wcsicmp(name.c_str(), L"title") == 0) key = PKEY_Title;
else if (_wcsicmp(name.c_str(), L"author") == 0) key = PKEY_Author;
else if (_wcsicmp(name.c_str(), L"keywords") == 0 || _wcsicmp(name.c_str(), L"tags") == 0) key = PKEY_Keywords;
else return false;
return true;
}
void PrintProp(IPropertyStore *store, const PROPERTYKEY &key)
{
PROPVARIANT prop;
PropVariantInit(&prop);
if (SUCCEEDED(store->GetValue(key, &prop))) {
if (prop.vt == VT_LPWSTR)
std::wcout
Подробнее здесь: [url]https://stackoverflow.com/questions/79798330/windows-file-add-tag-metadata[/url]
1761274416
Anonymous
Используя этот ответ, я включил документ Office, например метаданные, для файлов .pdf. Теперь у меня есть такая панель сведений о Windows: [img]https://i.sstatic.net/3KJFI6Rl.png[/img] И Теги, которые я туда добавляю, отображаются в столбце "Теги" в подробном представлении Проводника. Раньше у меня был такой код: [code]#include #include #include #include #include #include #pragma comment(lib, "Ole32.lib") #pragma comment(lib, "Propsys.lib") // Common property keys manually defined (from propkey.h) const PROPERTYKEY PKEY_Title = { {0xf29f85e0, 0x4ff9, 0x1068,{0xab,0x91,0x08,0x00,0x2b,0x27,0xb3,0xd9}}, 2 }; const PROPERTYKEY PKEY_Author = { {0xf29f85e0, 0x4ff9, 0x1068,{0xab,0x91,0x08,0x00,0x2b,0x27,0xb3,0xd9}}, 4 }; const PROPERTYKEY PKEY_Keywords = { {0xd5cdd505, 0x2e9c, 0x101b,{0x93,0x97,0x08,0x00,0x2b,0x2c,0xf9,0xae}}, 5 }; const PROPERTYKEY PKEY_Tags = PKEY_Keywords; // alias // Map key name (string) → PROPERTYKEY bool GetPropertyKey(const std::wstring &name, PROPERTYKEY &key) { if (_wcsicmp(name.c_str(), L"title") == 0) key = PKEY_Title; else if (_wcsicmp(name.c_str(), L"author") == 0) key = PKEY_Author; else if (_wcsicmp(name.c_str(), L"keywords") == 0 || _wcsicmp(name.c_str(), L"tags") == 0) key = PKEY_Keywords; else return false; return true; } void PrintProp(IPropertyStore *store, const PROPERTYKEY &key) { PROPVARIANT prop; PropVariantInit(&prop); if (SUCCEEDED(store->GetValue(key, &prop))) { if (prop.vt == VT_LPWSTR) std::wcout Подробнее здесь: [url]https://stackoverflow.com/questions/79798330/windows-file-add-tag-metadata[/url]