|
-
Nov 19th, 2002, 07:07 AM
#1
Thread Starter
New Member
Duration of video file!
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!
-
Nov 19th, 2002, 07:08 AM
#2
Banned
Do you mean you want it through code?
-
Nov 19th, 2002, 07:52 AM
#3
Thread Starter
New Member
Duration of video file!
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!
-
Nov 19th, 2002, 08:18 AM
#4
Hyperactive Member
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
Simon Caiger
Documentation is like sex; when it's good, it's very, very good, and when it's bad, it's better than nothing.
-
Nov 19th, 2002, 08:24 AM
#5
Hyperactive Member
Oh and you need to use the Quartz.dll
Simon Caiger
Documentation is like sex; when it's good, it's very, very good, and when it's bad, it's better than nothing.
-
Nov 20th, 2002, 03:45 AM
#6
Thread Starter
New Member
Duration of video file!
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.
-
Nov 21st, 2002, 04:21 AM
#7
Hyperactive Member
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.
Simon Caiger
Documentation is like sex; when it's good, it's very, very good, and when it's bad, it's better than nothing.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|