This was created as a response for this thread. Basically, it is a way to read (not write) all those extra properties that Windows has. This code requires a reference to "Microsoft Shell Controls And Automation" which is under the COM tab.
You also need to add the ShellFile.vb file to your project.
In the example I will retrieve the frame width of a video:
Code:
Output:Code:Public Class Form1 Private Sub Button1_Click(ByVal sender As System.Object, _ ByVal e As System.EventArgs) _ Handles Button1.Click '//create the wrapped file by passing in a path to a file Using file = New ShellFile("C:\Users\Public\Videos\Sample Videos\Wildlife.wmv") '//access the extended property by name (case insensitive search) Dim frameWidth = file.ExtendedProperties("frame width") '//check for nothing because if you attempt to index a property '//that doesn't exist then it will return null (nothing) If frameWidth IsNot Nothing Then MessageBox.Show(frameWidth.Value) End If End Using End Sub End Class
You can refer to this to see a relatively current list of valid extended properties by operating system. Or, you can just output all the extended property names that the code produces.
This code was tested on x64 Windows 7 Home Premium. Code contains Xml commenting as well.




Reply With Quote
