PDA

Click to See Complete Forum and Search --> : CD Player - determining track number


Sarah W
Jul 7th, 2000, 06:33 AM
I'm writing a cd player in VB6 using API calls - I have been using code to detect which track is currently playing but it doesn't appear to work.

I have created a playlist feature which means that the tracks do not have to have any particular order therefore I need to know what the ACTUAL track is rather than guess using listindexes.

The code I have been using contains this section but today it's screwing up and telling me the wrong track number - is there a better way??

mciSendString "status cd position", s, Len(s), 0
Track = CInt(Mid$(s, 1, 2))
Min = CInt(Mid$(s, 4, 2))
Sec = CInt(Mid$(s, 7, 2))

skullb
Jul 7th, 2000, 07:18 AM
so it worked before?

remember that when u get status the returnd string it`s filled with "0" after the actual value that u were looking for ... hope that helps ... anyways u could use
"status current track" string ...


http://msdn.microsoft.com/library/psdk/multimed/mmcmdstr_6tyl.htm

here`s a piece of similar code I`m using

Public Property Get status() As String 'get current status of the song .. (playing ,stopped etc)
If opened = False Then Exit Property
Dim start As Integer
mciReturnLong = mciSendString("Status song mode ", mciReturnString, 255, 0)
start = Val#(InStr(mciReturnString, Chr$(0)))
status = Left$(mciReturnString, start - 1)
End Property