|
vbAccelerator - Contents of code file: frmRipDialog.frmThis file is part of the download VB6 CD Ripper, which is described in the article CD Ripping in VB Part 1. VERSION 5.00 Object = "{831FDD16-0C5C-11D2-A9FC-0000F8754DA1}#2.0#0"; "MSCOMCTL.OCX" Begin VB.Form frmRipDialog BorderStyle = 3 'Fixed Dialog Caption = "CD Rip in Progress" ClientHeight = 2460 ClientLeft = 5820 ClientTop = 4410 ClientWidth = 5100 BeginProperty Font Name = "Tahoma" Size = 8.25 Charset = 0 Weight = 400 Underline = 0 'False Italic = 0 'False Strikethrough = 0 'False EndProperty LinkTopic = "Form1" MaxButton = 0 'False MinButton = 0 'False ScaleHeight = 2460 ScaleWidth = 5100 ShowInTaskbar = 0 'False StartUpPosition = 1 'CenterOwner Begin MSComctlLib.ProgressBar prgSelected Height = 315 Left = 120 TabIndex = 2 Top = 1140 Width = 4935 _ExtentX = 8705 _ExtentY = 556 _Version = 393216 Appearance = 0 End Begin VB.CommandButton cmdCancel Cancel = -1 'True Caption = "Cancel" Height = 435 Left = 1920 TabIndex = 0 Top = 1920 Width = 1275 End Begin MSComctlLib.ProgressBar prgTrack Height = 315 Left = 120 TabIndex = 3 Top = 1560 Width = 4935 _ExtentX = 8705 _ExtentY = 556 _Version = 393216 Appearance = 0 End Begin VB.Label lblInfo Alignment = 2 'Center Height = 855 Left = 180 TabIndex = 1 Top = 120 Width = 4815 End End Attribute VB_Name = "frmRipDialog" Attribute VB_GlobalNameSpace = False Attribute VB_Creatable = False Attribute VB_PredeclaredId = True Attribute VB_Exposed = False Option Explicit Private m_cToc As cToc Private m_selTracks() As Long Private m_selCount As Long Private m_sDir As String Private m_bRipping As Boolean Private m_bCancel As Boolean Public Sub RipSelected() Dim i As Long m_bRipping = True For i = 1 To m_selCount If (m_bRipping) Then Rip m_selTracks(i) prgSelected.value = i End If Next i m_bRipping = False Unload Me End Sub Private Sub Rip(ByVal lTrack As Long) Dim sFile As String Dim cWriter As cWAVWriter Dim cTrack As cTocEntry prgTrack.value = 0 sFile = m_sDir & "Track" & Format(lTrack, "00") & ".wav" Set cWriter = New cWAVWriter If (cWriter.OpenFile(sFile)) Then Set cTrack = m_cToc.Entry(lTrack) lblInfo.Caption = "Ripping track " & cTrack.TrackNumber & _ " (" & prgSelected.value + 1 & " of " & prgSelected.Max & ") to " & _ sFile & "..." Dim cTrackRip As New cCDTrackRipper cTrackRip.CreateForTrack cTrack If (cTrackRip.OpenRipper()) Then Do While cTrackRip.Read cWriter.WriteWavData cTrackRip.ReadBufferPtr, cTrackRip.ReadBufferSize prgTrack.value = cTrackRip.PercentComplete DoEvents If (m_bCancel) Then Exit Do End If Loop cTrackRip.CloseRipper cWriter.CloseFile If (m_bCancel) Then lblInfo.Caption = "Cancelled" On Error Resume Next Kill sFile m_bRipping = False Else lblInfo.Caption = "Completed track " & cTrack.TrackNumber End If End If End If End Sub Public Property Let OutputDir(ByVal sDir As String) m_sDir = sDir If (right(sDir, 1) <> "\") Then m_sDir = m_sDir & "\" End If End Property Public Property Let RipTOC(cT As cToc) Set m_cToc = cT End Property Public Property Let RipTrack(ByVal lIndex As Long, ByVal value As Boolean) Dim i As Long For i = 1 To m_selCount If (m_selTracks(i) = lIndex) Then Exit Property End If Next i m_selCount = m_selCount + 1 ReDim Preserve m_selTracks(1 To m_selCount) As Long m_selTracks(m_selCount) = lIndex End Property Private Sub cmdCancel_Click() ' If (m_bRipping) Then m_bCancel = True Else Unload Me End If ' End Sub Private Sub Form_Load() ' prgSelected.value = 0 prgSelected.Max = m_selCount prgTrack.value = 0 prgTrack.Max = 100 lblInfo.Caption = "Preparing to rip " & m_selCount & "tracks..." Me.Show Me.Refresh ' End Sub Private Sub Form_QueryUnload(Cancel As Integer, UnloadMode As Integer) If (m_bRipping) Then cmdCancel_Click Cancel = True End If End Sub
|
|||
|
||||
|