C#通过shell32获取文件详细备注信息
来源:互联网 发布:阿里云cdn配置https 编辑:程序博客网 时间:2024/06/16 22:43
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;
更多:
ffmpeg ffplay ffprobe资料整理
C#使FFmpeg 将视频格式转换成MP4示例
1 0
- C#通过shell32获取文件详细备注信息
- C#获取文件详细备注信息
- C#获取文件详细备注信息
- C#获取文件详细备注信息
- C#获取文件详细备注信息,MP3的Tag等等
- Shell32获取视频信息
- 使用shell32.dll获取浏览器相关信息
- c#通过oledb获取excel文件表结构信息
- c#通过oledb获取excel文件表结构信息
- c#获取文件信息
- C#获取文件信息
- C#通过Shell32.dll禁用或启用网卡
- pom文件标签详细备注
- 给表添加备注信息及获取备注信息
- c#获取文件版本信息
- C# 获取选择文件信息
- C#通过WMI获取系统信息
- 如何通过C#获取硬件信息。
- 小码哥HTML5培训给你未来锦上添花
- HDU 5764 After a Sleepless Night(dfs)
- 几种PHP实现网页抓取的程序代码
- Spring配置dubbo时报错: does not support XML
- 简单的nginx代理负载搭建
- C#通过shell32获取文件详细备注信息
- dubbo分布式服务
- 模仿今日头条客户端的界面及简单功能实现
- 使用MediaPlayer在Service中后台播放网络音乐
- Servlet_01:eclipse 创建 Web 项目
- 基于vs2005+wince6.0系统的触摸屏 tcp/ip联调总结
- 实现Home键效果
- Mysql配置Mysql-proxy读写分离
- salt常见用法