Atlanta Custom Software Development 

 
   Search        Code/Page
 

User Login
Email

Password

 

Forgot the Password?
Services
» Web Development
» Maintenance
» Data Integration/BI
» Information Management
Programming
  Database
Automation
OS/Networking
Graphics
Links
Tools
» Regular Expr Tester
» Free Tools

Determine the total playing time of an Audio CD

Total Hit ( 2617)

Rate this article:     Poor     Excellent 

 Submit Your Question/Comment about this article

Rating


 


The Microsoft Multimedia Control lets you easily determine the total playing time of an Audio CD: you only need to correctly initialize the control and then decipher the value returned by its Length property. Use the following code as a guideline for your routines:

Click here to copy the following block
Private Sub cmdDisplayTime_Click()
  Dim Value As Integer
  Dim TotalTime As String
  
  With MMControl1
    ' Initialize the Multimedia control
    .DeviceType = "CDAudio"
    .TimeFormat = 10
    .Command = "Open"
    ' seconds are held in the most significant byte
    Value = (.Length \ 256) And 255
    TotalTime = Right$("0" & CStr(Value), 2) & """"
    ' minutes are held in the least significant byte
    Value = (.Length And 255) Mod 60
    TotalTime = Right$("0" & CStr(Value), 2) & "' " & TotalTime
    Value = (.Length And 255) \ 60
    If Value > 0 Then
      ' display hour value only if necessary
      TotalTime = CStr(Value) & "h " & TotalTime
    End If
    MsgBox TotalTime
  End With
  
End Sub


Submitted By : Nayan Patel  (Member Since : 5/26/2004 12:23:06 PM)

Job Description : He is the moderator of this site and currently working as an independent consultant. He works with VB.net/ASP.net, SQL Server and other MS technologies. He is MCSD.net, MCDBA and MCSE. In his free time he likes to watch funny movies and doing oil painting.
View all (893) submissions by this author  (Birth Date : 7/14/1981 )


Home   |  Comment   |  Contact Us   |  Privacy Policy   |  Terms & Conditions   |  BlogsZappySys

© 2008 BinaryWorld LLC. All rights reserved.