C # obtain detailed object remarks, MP3 tags, etc.

Source: Internet
Author: User

First, you must add shell32: The program needs to reference shell32.dll. My specific steps are as follows: Right-click "Reference" and choose "add reference". In the displayed dialog box, select the "com" tab, find the Microsoft shell controls andautomation 1.0 component"

Using system. io; using shell32; openfiledialog ofd = new openfiledialog (); // a new method ofd. filter = "MP3 files(folder) | *. MP3 | WMA files (*. WMA) | *. WMA | all files (*. *) | *. * "; ofd. multiselect = true; // multiple ofd options are allowed. restoredirectory = true; // remember the last file path ofd. showdialog (); // display the file opening window filepath = ofd. filename; // obtain the complete file path fileinfo finfo = new fileinfo (filepath); shellclass SH = new shellclass (); folder dir = Sh. namespace (path. getdirectoryname (filepath); folderitem item = dir. parsename (path. getfilename (filepath); stringbuilder sb = new stringbuilder (); For (INT I =-1; I <50; I ++) {sb. append (I. tostring (); sb. append (":"); sb. append (dir. getdetailsof (item, I); sb. append ("\ r \ n");} string STR = sb. tostring ();

Output result:

-1: Project type: MP3 audio size: 5.42 mb artist: Zhang jingxuan length: 00:03:51
0: The Kiss is too realistic. 42 mb2: MP3 format sound/7/30/8/3/7/30/17: 036: A7: 8: 9: audio 10: ZJD-PC \ zjd11: Music 12: 13: Zhang jingxuan 14: urban emotions15: 200816: Chinese pop music [Chinese pop music] 17: 18: 19: not rated 20: Zhang jingxuan 21: The Kiss is too realistic 22: 23: 24: 25: 26: 1427: 00: 03: 5128 :? 196kbps29: No 30: 31: 32: 33: 34: 35: 36: 37: 38: 39: 40: 41: 42: 43: 44: 45: 46: 47: 48: 49:

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.