get file properties summary advanced

ethicalhacker

Well-known member
Joined
Apr 22, 2007
Messages
142
Location
Delhi,India
Programming Experience
5-10
when you right click on a video file and click on properties and then click the summary tab and click on the advanced button there are various properties like width height duration bit rate frame rate data rate etc. How can we get these values programmatically and show them in a message box or something. Ive read a lot about file info class but its to no use, please help.
 
File Properties Summary

I know this is an old thread so save your breath. It shows up on the searches for the Summary properties and I hope it will help some one who wants to do this.

It is not pretty but, it works on most file and gets what is available. The only thing I haven't been able to get is the lyrics of an audio file.
The following shows all the available properties and should be modified to only show the properties available by file type/extension.

VB.NET:
[COLOR=#0000ff]Dim[/COLOR][SIZE=3] arrHeaders(40) [/SIZE][SIZE=3][COLOR=#0000ff][SIZE=3][COLOR=#0000ff]As [/COLOR][/SIZE][/COLOR][/SIZE][SIZE=3][COLOR=#0000ff][SIZE=3][COLOR=#0000ff]String

[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=3][COLOR=#0000ff][SIZE=3][COLOR=#0000ff]Private[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=3][COLOR=#0000ff][SIZE=3][COLOR=#0000ff]Sub[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=3] GetExtendedProps([/SIZE][SIZE=3][COLOR=#0000ff][SIZE=3][COLOR=#0000ff]ByVal[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=3] file_path [/SIZE][SIZE=3][COLOR=#0000ff][SIZE=3][COLOR=#0000ff]As [/COLOR][/SIZE][/COLOR][/SIZE][SIZE=3][COLOR=#0000ff][SIZE=3][COLOR=#0000ff]String[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=3])

[/SIZE][SIZE=3][COLOR=#008000][SIZE=3][COLOR=#008000]'There is an actual file path
[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=3][COLOR=#0000ff][SIZE=3][COLOR=#0000ff]If[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=3] file_path = [/SIZE][SIZE=3][COLOR=#a31515][SIZE=3][COLOR=#a31515]""[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=3][COLOR=#0000ff][SIZE=3][COLOR=#0000ff]Then [/COLOR][/SIZE][/COLOR][/SIZE][SIZE=3][COLOR=#0000ff][SIZE=3][COLOR=#0000ff]Exit [/COLOR][/SIZE][/COLOR][/SIZE][SIZE=3][COLOR=#0000ff][SIZE=3][COLOR=#0000ff]Sub
[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=3][COLOR=#0000ff][SIZE=3][COLOR=#0000ff]If[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=3] SetUpListView() [/SIZE][SIZE=3][COLOR=#0000ff][SIZE=3][COLOR=#0000ff]Then [/COLOR][/SIZE][/COLOR][/SIZE][SIZE=3][COLOR=#008000][SIZE=3][COLOR=#008000]'ListView has been formatted

[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=3][COLOR=#0000ff][SIZE=3][COLOR=#0000ff]Dim[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=3] shell [/SIZE][SIZE=3][COLOR=#0000ff][SIZE=3][COLOR=#0000ff]As [/COLOR][/SIZE][/COLOR][/SIZE][SIZE=3][COLOR=#0000ff][SIZE=3][COLOR=#0000ff]New[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=3] Shell32.Shell
[/SIZE][SIZE=3][COLOR=#0000ff][SIZE=3][COLOR=#0000ff]Dim[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=3] objFolder [/SIZE][SIZE=3][COLOR=#0000ff][SIZE=3][COLOR=#0000ff]As[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=3] Shell32.Folder[/SIZE][SIZE=3]

objFolder = shell.NameSpace(Path.GetDirectoryName(file_path))

[/SIZE][SIZE=3][COLOR=#008000][SIZE=3][COLOR=#008000]'Load the Propery Names into arrHeaders
[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=3][COLOR=#0000ff][SIZE=3][COLOR=#0000ff]For[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=3] i = 0 [/SIZE][SIZE=3][COLOR=#0000ff][SIZE=3][COLOR=#0000ff]To[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=3] 40
[/SIZE][SIZE=3][COLOR=#008000][SIZE=3][COLOR=#008000]'27 and 28 missing Prop Name for images 
[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=3][COLOR=#0000ff][SIZE=3][COLOR=#0000ff]If[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=3] i = 27 [/SIZE][SIZE=3][COLOR=#0000ff][SIZE=3][COLOR=#0000ff]Then
[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=3]arrHeaders(27) = [/SIZE][SIZE=3][COLOR=#a31515][SIZE=3][COLOR=#a31515]"Width"
[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=3][COLOR=#0000ff][SIZE=3][COLOR=#0000ff]ElseIf[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=3] i = 28 [/SIZE][SIZE=3][COLOR=#0000ff][SIZE=3][COLOR=#0000ff]Then
[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=3]arrHeaders(28) = [/SIZE][SIZE=3][COLOR=#a31515][SIZE=3][COLOR=#a31515]"Height"
[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=3][COLOR=#0000ff][SIZE=3][COLOR=#0000ff]Else
[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=3]
arrHeaders(i) = objFolder.GetDetailsOf(objFolder.Items, i)
[/SIZE][SIZE=3][COLOR=#0000ff][SIZE=3][COLOR=#0000ff]
End[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=3][COLOR=#0000ff][SIZE=3][COLOR=#0000ff]If
[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=3][COLOR=#0000ff][SIZE=3][COLOR=#0000ff]
Next

[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=3][COLOR=#008000][SIZE=3][COLOR=#008000]'Iterate all the files in the files' folder
[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=3][COLOR=#008000][SIZE=3][COLOR=#008000]' Gets the Extented Properties and displays in a ListView
[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=3][COLOR=#0000ff][SIZE=3][COLOR=#0000ff]For [/COLOR][/SIZE][/COLOR][/SIZE][SIZE=3][COLOR=#0000ff][SIZE=3][COLOR=#0000ff]Each[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=3] strFileName [/SIZE][SIZE=3][COLOR=#0000ff][SIZE=3][COLOR=#0000ff]As[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=3] Shell32.FolderItem2 [/SIZE][SIZE=3][COLOR=#0000ff][SIZE=3][COLOR=#0000ff]In[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=3] objFolder.Items
[/SIZE][SIZE=3][COLOR=#0000ff][SIZE=3][COLOR=#0000ff]
If[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=3] strFileName.Path = file_path [/SIZE][SIZE=3][COLOR=#0000ff][SIZE=3][COLOR=#0000ff]Then [/COLOR][/SIZE][/COLOR][/SIZE][SIZE=3][COLOR=#008000][SIZE=3][COLOR=#008000]'Only get the properties for the selected file
[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=3][COLOR=#0000ff][SIZE=3][COLOR=#0000ff]
For[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=3] i = 0 [/SIZE][SIZE=3][COLOR=#0000ff][SIZE=3][COLOR=#0000ff]To[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=3] 40
[/SIZE][SIZE=3][COLOR=#0000ff][SIZE=3][COLOR=#0000ff]
Dim[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=3] li [/SIZE][SIZE=3][COLOR=#0000ff][SIZE=3][COLOR=#0000ff]As[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=3] ListViewItem

li = lvExtProps.Items.Add([/SIZE][SIZE=3][COLOR=#0000ff][SIZE=3][COLOR=#0000ff]CStr[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=3](i))
li.SubItems.Add(arrHeaders(i))
li.SubItems.Add([/SIZE][SIZE=3][COLOR=#0000ff][SIZE=3][COLOR=#0000ff]CStr[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=3](objFolder.GetDetailsOf(strFileName, i)))
[/SIZE][SIZE=3][COLOR=#0000ff][SIZE=3][COLOR=#0000ff]
Next
[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=3][COLOR=#0000ff][SIZE=3][COLOR=#0000ff]
End[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=3][COLOR=#0000ff][SIZE=3][COLOR=#0000ff]If
[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=3][COLOR=#0000ff][SIZE=3][COLOR=#0000ff]
Next
[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=3][COLOR=#008000][SIZE=3][COLOR=#008000]
[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=3][COLOR=#008000][SIZE=3][COLOR=#008000]'Set the ListViews and Forms Width property
[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=3][COLOR=#0000ff][SIZE=3][COLOR=#0000ff]Call[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=3] Resize_ListView_Form()
[/SIZE][SIZE=3][COLOR=#0000ff][SIZE=3][COLOR=#0000ff]
End[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=3][COLOR=#0000ff][SIZE=3][COLOR=#0000ff]If

[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=3][COLOR=#0000ff][SIZE=3][COLOR=#0000ff]End[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=3][COLOR=#0000ff][SIZE=3][COLOR=#0000ff]Sub[/COLOR][/SIZE][/COLOR][/SIZE]
 
I have been using the HundredMilesSoftware.UltraID3Lib to get the lyrics it works ok. It would be nice if we could get all the properties in one place.
 
Back
Top