Hey
How do I get Visual Basic to find information about a video file, such as its duration? In Windows XP it is easy to find this information by choosing the options for the file - so it must be possible!
Thank you in anticipation!
Printable View
Hey
How do I get Visual Basic to find information about a video file, such as its duration? In Windows XP it is easy to find this information by choosing the options for the file - so it must be possible!
Thank you in anticipation!
Do you mean you want it through code?
I am not sure what you mean, but I am coding a program, where I need Visual Basic to know the duration of a video file, so that I can calculate with it!
Yes, this can be done.
Just a chunk from a large prog I did once
VB Code:
Set media_control = New FilgraphManager 'Filter controls and properties iFile = FreeFile Open App.Path + "\TempAVI.avi" For Binary As #iFile bArr = LoadResData(sMovieToPlay, "CUSTOM") 'change this to reflect the correct ID Put #iFile, , bArr Close #iFile media_control.RenderFile (App.Path + "\TempAVI.avi") Set media_window = media_control 'Payback window properties and controls Set media_position = media_control 'Playback position properties and controls
The play time is accessed something like
media_position.StopTime
Oh and you need to use the Quartz.dll
Hey I have tried to use the code above, but it wont work. Obvious I'm not that good at VB, so you have to make it very clear what I have to change in the code.
First of all I can't choose FilgraphManager. I have tried to use the name of my own project, but it "wasn't expected".
Next VB can't find identifier for sMoviePlay.
Hi,
Sorry, the chunk of code I posted is just a bit of my program.
The movies are stored in a resource file in my case and the movie identified by the string "sMovieToPlay" is shown being loaded into a temporary file.
You could just use
VB Code:
media_control.RenderFile (App.Path + "\TempAVI.avi")
to load your .avi
You need to set a referenve to the "Active Movie Control Type Library in the Project References.
Hope this helps a bit more.
At the moment project pressures don't allow me time to put together a working example.
If you're still stuck let me know and when I have a bit more time, I will post a full example.