dcsimg
Login | Register   
RSS Feed
Download our iPhone app
TODAY'S HEADLINES  |   ARTICLE ARCHIVE  |   FORUMS  |   TIP BANK
Browse DevX
Sign up for e-mail newsletters from DevX

By submitting your information, you agree that devx.com may send you DevX offers via email, phone and text message, as well as email offers about other products and services that DevX believes may be of interest to you. DevX will process your information in accordance with the Quinstreet Privacy Policy.


Tip of the Day
Language: VB5,VB6
Expertise: Intermediate
Feb 28, 2001

WEBINAR:

On-Demand

Application Security Testing: An Integral Part of DevOps


Determine the total playing time of an Audio CD

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:

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

Francesco Balena
 
Comment and Contribute

 

 

 

 

 


(Maximum characters: 1200). You have 1200 characters left.

 

 

Sitemap
Thanks for your registration, follow us on our social networks to keep up-to-date