Hi everyone!
How can I get the duration of an audio file without using a WMP?
- zynder
Printable View
Hi everyone!
How can I get the duration of an audio file without using a WMP?
- zynder
VB Code:
Private Declare Function mciSendString Lib "winmm" Alias "mciSendStringA" (ByVal lpstrCommand As String, ByVal lpstrReturnString As String, ByVal uReturnLength As Long, ByVal hwndCallback As Long) As Long Dim FileName As String Private Sub Form_Load() Dim RetString As String * 256 FileName = "D:\Family\LG\in_the_end.mid" mciSendString "Open " & FileName & " alias SoundFile", vbNullString, 0, 0& mciSendString "Set SoundFile time format milliseconds", vbNullString, 0, 0& mciSendString "Status SoundFile length", RetString, Len(RetString), 0& MsgBox CLng(RetString) & " milliseconds" mciSendString "Close SoundFile", vbNullString, 0, 0& End Sub
Or alternatively you could use the MCI control
Thanks Andrew for the reply! I will try that out. It looks promising.
Another question. What is an MCI control? Sorry i'm not familiar with this control.
Its the 'Microsoft Media control'.
Quote:
The Multimedia control allows you to manage Media Control Interface (MCI) devices. These devices include: sound boards, MIDI sequencers, CD-ROM drives, audio players, videodisc players, and videotape recorders and players.
Ok. Thanks!