1.从系统Window/System32文件夹中Copy出 Shell32.dll Com组件

将Shell32.dll文件引用到项目中,并设置“嵌入互操作类型”为false

http://blog.csdn.net/u011127019/article/details/52166033

2.代码实例:

ShellClass sh = new ShellClass();
Folder dir = sh.NameSpace(Path.GetDirectoryName(filename));
FolderItem item = dir.ParseName(Path.GetFileName(filename));
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();
索引说明(视频文件常用属性):
0--文件名称

1---文件大小
2---文件类型
3---修改时间
4---创建时间
8---可用性
27---时长

28--比特率

303--数据速率

304--帧高度

305--帧速率

306--帧宽度

307--视频方向

308--总比特率

3.代码实例(有不可取的地方):

//初始化Shell接口
ShellClass sh = new ShellClass();
//获取文件所在父目录对象
Folder dir = sh.NameSpace(Path.GetDirectoryName(filename));
//获取文件对象的FolderItem对象
FolderItem item = dir.ParseName(Path.GetFileName(filename));
//字典存放属性名和属性值
Dictionary<string, string> dic = new Dictionary<string, string>();
//循环获取详细信息
int i = 0;
while (true)
{
//获取属性名称
string key = dir.GetDetailsOf(null,i);
if (string.IsNullOrEmpty(key))
{
//当无属性可取时,退出循环
break;
}
//获取属性值
string value = dir.GetDetailsOf(item,i);
dic.Add(key,value);
i++;
}
listBox.ItemsSource = dic;

C#通过shell32获取文件详细备注信息的更多相关文章

  1. C# 获取文件详细备注信息 (如图片、视频实际创建时间)

    在整理照片/视频时想根据实际拍摄时间重命名文件,但 System.IO.FileInfo 只能获取到文件的创建时间或最后写入时间,不符合要求,遂寻找解决方案 方案 1: System.Drawing ...

  2. C#获取FTP文件详细备注信息

    private void button1_Click(object sender, RoutedEventArgs e) { Uri uri = new Uri("ftp://192.168 ...

  3. fsck获取文件的block信息和位置信息

    原文链接:lxw的大数据田地 » hdfs fsck命令查看HDFS文件对应的文件块信息(Block)和位置信息(Locations) 关键字:hdfs fsck.block.locations 在H ...

  4. Windows下通过命令行 获取文件详细信息

    @echo off echo version: wmic datafile where Name="C:\\Product\\File\\Release\\1.1.1\\File.exe&q ...

  5. 利用php获取图片完整Exif信息类 获取图片详细完整信息类

    <?php /** * @Author: TonyLevid * @Copyright: TonyLevid.com * @Name: Image Exif Class * @Version: ...

  6. Thinkphp5获取文件上传信息

    Thinkphp5内置有处理文件上传的方法,因在开发文档没有找到获取上传文件基本信息的说明,故在这里做一下记录. $file = request()->file('input类型为file的na ...

  7. R语言学习笔记(十五):获取文件和目录信息

    file.info() 参数是表示文件名称的字符串向量,函数会给出每个文件的大小.创建时间.是否为目录等信息. > file.info("z.txt") size isdir ...

  8. C#开发BIMFACE系列6 服务端API之获取文件信息

    在<C#开发BIMFACE系列4 服务端API之源上传文件>.<C#开发BIMFACE系列5 服务端API之文件直传>两篇文章中详细介绍了如何将本地文件上传到BIMFACE服务 ...

  9. C#开发BIMFACE系列7 服务端API之获取文件信息列表

    系列目录     [已更新最新开发文章,点击查看详细] 本文详细介绍如何获取BIMFACE平台中所有上传过的文件信息列表. 请求地址:GET https://file.bimface.com/file ...

随机推荐

  1. 学习笔记42—Win7下安装Linux双系统

    1.下载Linux镜像:http://mirrors.163.com/ubuntu-releases/18.04.1/ 方法一: 1.用软通牒软件将Linux的镜像写入空的优盘中, 具体如下: 1) ...

  2. MySQL学习(四)

    1 MySQL日期和时间类型 创建一个包含DATE类型的表 mysql> create table test3( -> star varchar(20) not null default ...

  3. Rest数据服务查询类-根据sql查询

    Rest数据服务查询类 需要iserver data服务支持,但请求的时候,不依赖SuperMap js lib包. 构造函数:QueryById=function(p_params): p_para ...

  4. 牛客小白月赛7 CSL的校园卡

    CSL的校园卡 思路: bfs,用状压表示走过的区域,然后和x1,y1,x2,y2构成所有的状态,然后标记一下就可以了 代码: #pragma GCC optimize(2) #pragma GCC ...

  5. HDU - 1400 Mondriaan's Dream

    HDU - 1400 思路: 轮廓线dp入门题 #include<bits/stdc++.h> using namespace std; #define fi first #define ...

  6. 第 7 章 多主机管理 - 047 - 管理 Machine

    管理 Machine Docker Machine 则很简单 docker-machine env host1 显示访问 host1 需要的所有环境变量: 根据提示,执行 eval $(docker- ...

  7. 滑动拼图 Sliding Puzzle

    2018-09-09 22:01:02 问题描述: 问题求解: 问题很Interesting,其实本质就是解空间遍历,使用BFS就可以很快的予以解决~ public int slidingPuzzle ...

  8. spring ----> aop测试需要的Maven依赖/测试时发生的一个exception

    <properties> <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> &l ...

  9. poj2891 扩展中国剩余定理

    求a1x1+r1=y...anxn+rn=y,crt合并 //#pragma GCC optimize(2) //#pragma GCC optimize(3) //#pragma GCC optim ...

  10. 牛客练习赛30-A/C

    链接:https://ac.nowcoder.com/acm/contest/216/A来源:牛客网 时间限制:C/C++ 1秒,其他语言2秒 空间限制:C/C++ 32768K,其他语言65536K ...