项目中引用 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.