Hello. I have created a CD player using mciSendStrings, but I am having trouble getting the current track. For some reason, the code below is always returning the current track as "1":

VB Code:
  1. Public getCurrentTrack As Integer = Nothing
  2.  
  3. Sub CDplay()
  4.         Try
  5.             Dim totalTime As String = Space(128)
  6.             mciSendString("close " & TheFile, CStr(0), 0, 0)
  7.             TheFile = Chr(34) & Trim(MP3File) & Chr(34)
  8.             mciSendString("open " & TheFile, CStr(0), 0, 0)
  9.             mciSendString("Set " & TheFile & " time format TMSF", 0, 0, 0)
  10.             mciSendString("Status " & TheFile & " current track", totalTime, 128, 0)
  11.             getCurrentTrack = Val(totalTime)
  12.             If getNumberTracks() = track Then
  13.                 mciSendString("Play " & TheFile & " from " & getCurrentTrack, 0, 0, 0)
  14.             Else
  15.                 mciSendString("Play " & TheFile & " from " & getCurrentTrack & " to " & getCurrentTrack + 1, 0, 0, 0)
  16.             End If
  17.         Catch exc As Exception
  18.             MessageBox.Show(exc.Message, "Error!", MessageBoxButtons.OK)
  19.         End Try
  20.     End Sub