home *** CD-ROM | disk | FTP | other *** search
/ Tricks of the Windows Gam…ming Gurus (2nd Edition) / Disc2.iso / msdn_vcb / samples / vc98 / atl / cdinfo / vbtest / frmcd.frm (.txt) next >
Encoding:
Visual Basic Form  |  1998-03-27  |  2.4 KB  |  79 lines

  1. VERSION 5.00
  2. Object = "{A393BE4C-2FBD-11D0-B939-000000000000}#1.0#0"; "CDInfo.dll"
  3. Begin VB.Form frmCD 
  4.    Caption         =   "Audio CD"
  5.    ClientHeight    =   7950
  6.    ClientLeft      =   1800
  7.    ClientTop       =   2055
  8.    ClientWidth     =   5700
  9.    LinkTopic       =   "Form1"
  10.    PaletteMode     =   1  'UseZOrder
  11.    ScaleHeight     =   7950
  12.    ScaleWidth      =   5700
  13.    Begin VB.ListBox lstCD 
  14.       Height          =   3375
  15.       Left            =   840
  16.       TabIndex        =   3
  17.       Top             =   3840
  18.       Width           =   3975
  19.    End
  20.    Begin VB.CommandButton cmdExit 
  21.       Cancel          =   -1  'True
  22.       Caption         =   "Exit"
  23.       Height          =   615
  24.       Left            =   3720
  25.       TabIndex        =   2
  26.       Top             =   1200
  27.       Width           =   1575
  28.    End
  29.    Begin VB.CommandButton cmdRead 
  30.       Caption         =   "Read CD"
  31.       Default         =   -1  'True
  32.       Height          =   615
  33.       Left            =   3720
  34.       TabIndex        =   1
  35.       Top             =   360
  36.       Width           =   1575
  37.    End
  38.    Begin CDINFOLibCtl.CCDInfo ctlCD 
  39.       Height          =   2895
  40.       Left            =   360
  41.       OleObjectBlob   =   "frmCD.frx":0000
  42.       TabIndex        =   0
  43.       Top             =   360
  44.       Width           =   2895
  45.    End
  46. Attribute VB_Name = "frmCD"
  47. Attribute VB_GlobalNameSpace = False
  48. Attribute VB_Creatable = False
  49. Attribute VB_PredeclaredId = True
  50. Attribute VB_Exposed = False
  51. Private Function GetLength(ByVal nSeconds As Integer) As String
  52.     Dim strLength As String
  53.     strLength = Str(nSeconds \ 60)
  54.     strLength = strLength + ":" + Format(nSeconds Mod 60, "0#")
  55.     GetLength = strLength
  56. End Function
  57. Private Sub cmdExit_Click()
  58.     End
  59. End Sub
  60. Private Sub cmdRead_Click()
  61.     Dim nTracks As Integer, nTrack As Integer
  62.     nTracks = ctlCD.Read
  63.     lstCD.Clear
  64.     If nTracks Then
  65.         For nTrack = 1 To nTracks
  66.             lstCD.AddItem "Track" + Str(nTrack) + Chr(9) + Chr(9) + GetLength(ctlCD.Length(nTrack))
  67.         Next nTrack
  68.     Else
  69.         MsgBox "Couldn't read CD"
  70.     End If
  71. End Sub
  72. Private Sub ctlCD_Click(ByVal nTrack As Integer)
  73. '   This will cause the lstCD_Click event to fire and the Play method called
  74.     lstCD.ListIndex = nTrack - 1
  75. End Sub
  76. Private Sub lstCD_Click()
  77.     ctlCD.Play (lstCD.ListIndex + 1)
  78. End Sub
  79.