C#获取文件详细备注信息
项目中引用 Shell32.dll;
using System.IO;
using Shell32;
ShellClass sh = new ShellClass();
Folder dir = sh.NameSpace(Path.GetDirectoryName(strPath));
FolderItem item = dir.ParseName(Path.GetFileName(strPath));
StringBuilder sb = new StringBuilder();
for (int i = -1; i < 50; i++)
{
// 0 Retrieves the name of the item.
// 1 Retrieves the size of the item.
// 2 Retrieves the type of the item.
// 3 Retrieves the date and time that the item was last modified.
// 4 Retrieves the attributes of the item.
// -1 Retrieves the info tip information for the item.
sb.Append(i.ToString());
sb.Append(":");
sb.Append(dir.GetDetailsOf(item, i));
sb.Append("/r/n");
}
string c = sb.ToString();