I am trying to get the resolution of an image or video file using GetDetailsOf in vb.net but I do not understand how to load a file into shell32.folderitem so I am doing it a very roundabout way.
OpenFileDialog1.ShowDialog()
Dim fi As New FileInfo(OpenFileDialog1.FileName)
Dim shell As New Shell32.Shell
Dim objFolder As Shell32.Folder
objFolder = shell.NameSpace(fi.DirectoryName)
For i As Integer = 0 To objFolder.Items.Count - 1
If objFolder.Items(i).name = fi.Name Then
Console.WriteLine(objFolder.GetDetailsOf(objFolder.Items(i), 31))
Console.WriteLine(objFolder.GetDetailsOf(objFolder.Items(i), 282))
Console.WriteLine(objFolder.GetDetailsOf(objFolder.Items(i), 280))
End If
Next
I am just looping through the folder until I find a match for my file. Is there a cleaner, faster way to do this? I just need to have a shell32.FolderItem from the full filename.
Also, can I rely on Detail 31 to always be resolution and 280/282 to be frame height/frame width? How can I know whether or not they will retrieve the same details on other computers without having to test it on a bunch of other computers?
Thanks.