home *** CD-ROM | disk | FTP | other *** search
/ Programming Languages Suite / ProgramD2.iso / Visual Database / Visual BASIC 5.0 (Ent. Edition) / Vb5ent Extractor.EXE / VB / SAMPLES / COMPTOOL / MCI / CD.FRM (.txt) < prev    next >
Encoding:
Visual Basic Form  |  1996-11-29  |  9.0 KB  |  271 lines

  1. VERSION 5.00
  2. Object = "{C1A8AF28-1257-101B-8FB0-0020AF039CA3}#1.1#0"; "MCI32.OCX"
  3. Begin VB.Form frmCD 
  4.    BorderStyle     =   1  'Fixed Single
  5.    ClientHeight    =   3120
  6.    ClientLeft      =   225
  7.    ClientTop       =   2700
  8.    ClientWidth     =   8415
  9.    LinkMode        =   1  'Source
  10.    LinkTopic       =   "Form1"
  11.    MaxButton       =   0   'False
  12.    MinButton       =   0   'False
  13.    ScaleHeight     =   3120
  14.    ScaleWidth      =   8415
  15.    Begin VB.PictureBox picCD4 
  16.       BackColor       =   &H00808080&
  17.       Height          =   3255
  18.       Left            =   0
  19.       ScaleHeight     =   3195
  20.       ScaleWidth      =   1515
  21.       TabIndex        =   11
  22.       Top             =   -15
  23.       Width           =   1570
  24.       Begin VB.PictureBox picCD5 
  25.          BackColor       =   &H00575757&
  26.          Height          =   2895
  27.          Left            =   120
  28.          ScaleHeight     =   2835
  29.          ScaleWidth      =   1245
  30.          TabIndex        =   12
  31.          Top             =   110
  32.          Width           =   1300
  33.       End
  34.    End
  35.    Begin VB.PictureBox picCD6 
  36.       BackColor       =   &H00808080&
  37.       Height          =   3255
  38.       Left            =   6845
  39.       ScaleHeight     =   3195
  40.       ScaleWidth      =   1515
  41.       TabIndex        =   13
  42.       Top             =   -15
  43.       Width           =   1575
  44.       Begin VB.PictureBox picCD7 
  45.          BackColor       =   &H00575757&
  46.          Height          =   2895
  47.          Left            =   120
  48.          ScaleHeight     =   2835
  49.          ScaleWidth      =   1245
  50.          TabIndex        =   14
  51.          Top             =   110
  52.          Width           =   1300
  53.       End
  54.    End
  55.    Begin VB.Frame fraCD1 
  56.       BackColor       =   &H00808080&
  57.       Caption         =   "MCI CD Player"
  58.       BeginProperty Font 
  59.          Name            =   "MS Serif"
  60.          Size            =   12
  61.          Charset         =   0
  62.          Weight          =   700
  63.          Underline       =   0   'False
  64.          Italic          =   0   'False
  65.          Strikethrough   =   0   'False
  66.       EndProperty
  67.       ForeColor       =   &H00000000&
  68.       Height          =   3135
  69.       Left            =   1560
  70.       TabIndex        =   0
  71.       Top             =   0
  72.       Width           =   5295
  73.       Begin VB.PictureBox picCD3 
  74.          Height          =   255
  75.          Left            =   720
  76.          Picture         =   "cd.frx":0000
  77.          ScaleHeight     =   195
  78.          ScaleWidth      =   915
  79.          TabIndex        =   9
  80.          Top             =   2520
  81.          Visible         =   0   'False
  82.          Width           =   975
  83.       End
  84.       Begin VB.Frame fraCD4 
  85.          BackColor       =   &H00808080&
  86.          Height          =   975
  87.          Left            =   2160
  88.          TabIndex        =   5
  89.          Top             =   2040
  90.          Width           =   2895
  91.          Begin VB.CommandButton cmdLoad 
  92.             Caption         =   "Load"
  93.             Height          =   255
  94.             Left            =   1920
  95.             TabIndex        =   6
  96.             Top             =   600
  97.             Width           =   855
  98.          End
  99.          Begin VB.PictureBox picCD1 
  100.             BackColor       =   &H00404040&
  101.             BorderStyle     =   0  'None
  102.             Height          =   255
  103.             Left            =   120
  104.             Picture         =   "cd.frx":09DA
  105.             ScaleHeight     =   255
  106.             ScaleWidth      =   2655
  107.             TabIndex        =   7
  108.             Top             =   240
  109.             Width           =   2655
  110.          End
  111.          Begin VB.Label lblIndicator 
  112.             BackColor       =   &H00404040&
  113.             Height          =   135
  114.             Left            =   1485
  115.             TabIndex        =   10
  116.             Top             =   600
  117.             Width           =   255
  118.          End
  119.       End
  120.       Begin VB.PictureBox picCD2 
  121.          Height          =   255
  122.          Left            =   720
  123.          Picture         =   "cd.frx":1078
  124.          ScaleHeight     =   195
  125.          ScaleWidth      =   915
  126.          TabIndex        =   8
  127.          Top             =   2040
  128.          Visible         =   0   'False
  129.          Width           =   975
  130.       End
  131.       Begin VB.Frame fraCD2 
  132.          BackColor       =   &H00808080&
  133.          Height          =   1455
  134.          Left            =   240
  135.          TabIndex        =   1
  136.          Top             =   480
  137.          Width           =   4815
  138.          Begin VB.Frame fraCD3 
  139.             BackColor       =   &H00808080&
  140.             Height          =   855
  141.             Left            =   240
  142.             TabIndex        =   2
  143.             Top             =   240
  144.             Width           =   855
  145.             Begin VB.Label lblTrackCaption 
  146.                BackColor       =   &H00808080&
  147.                Caption         =   " Track   "
  148.                Height          =   255
  149.                Left            =   120
  150.                TabIndex        =   4
  151.                Top             =   480
  152.                Width           =   615
  153.             End
  154.             Begin VB.Label lblTrack 
  155.                Alignment       =   2  'Center
  156.                Caption         =   "0"
  157.                Height          =   255
  158.                Left            =   240
  159.                TabIndex        =   3
  160.                Top             =   240
  161.                Width           =   375
  162.             End
  163.          End
  164.          Begin MCI.MMControl mciCDPlayer 
  165.             Height          =   735
  166.             Left            =   1200
  167.             TabIndex        =   15
  168.             Top             =   360
  169.             Width           =   3540
  170.             _ExtentX        =   6244
  171.             _ExtentY        =   1296
  172.             DeviceType      =   ""
  173.             FileName        =   ""
  174.          End
  175.       End
  176.    End
  177. Attribute VB_Name = "frmCD"
  178. Attribute VB_GlobalNameSpace = False
  179. Attribute VB_Creatable = False
  180. Attribute VB_PredeclaredId = True
  181. Attribute VB_Exposed = False
  182. Private Sub cmdLoad_Click()
  183.     ' Open the CD device -- the disc must already be in the drive.
  184.     On Error GoTo MCI_ERROR
  185.     mciCDPlayer.Command = "Open"
  186.     On Error GoTo 0
  187.     ' Set the time format.
  188.     mciCDPlayer.TimeFormat = vbMCIFormatTmsf
  189.     ' Disable the Load command button, and display the "disc in drive" bitmap.
  190.     cmdLoad.Enabled = False
  191.     picCD1.Picture = picCD3.Picture
  192.     ' Set the track number to the first track.
  193.     lblTrack.Caption = "1"
  194.     Exit Sub
  195. MCI_ERROR:
  196.     DisplayErrorMessageBox
  197.     Resume MCI_EXIT
  198. MCI_EXIT:
  199.     Unload frmCD
  200. End Sub
  201. Private Sub Form_Load()
  202.     mciCDPlayer.Wait = True
  203.     mciCDPlayer.UpdateInterval = 0
  204.     ' Set the DeviceType property to a musical CD device.
  205.     mciCDPlayer.DeviceType = "CDAudio"
  206.     ' Set the track number to 0 (default).
  207.     lblTrack.Caption = "0"
  208. End Sub
  209. Private Sub Form_Unload(Cancel As Integer)
  210.     frmMCITest.Show
  211. End Sub
  212. Private Sub mciCDPlayer_EjectClick(Cancel As Integer)
  213.     ' Enable the Load command button, and display the "disc out of drive" bitmap.
  214.     cmdLoad.Enabled = True
  215.     picCD1.Picture = picCD2.Picture
  216.     mciCDPlayer.UpdateInterval = 0
  217.     ' Eject the disc from the CD drive, and close the device.
  218.     On Error GoTo MCI_ERROR2
  219.     mciCDPlayer.Command = "Eject"
  220.     mciCDPlayer.Command = "Close"
  221.     On Error GoTo 0
  222.     ' Set the track number back to 0.
  223.     lblTrack.Caption = "0"
  224.     ' Set the "play indicator" to off.
  225.     lblIndicator.BackColor = &H404040
  226.     Exit Sub
  227. MCI_ERROR2:
  228.     DisplayErrorMessageBox
  229.     Resume Next
  230. End Sub
  231. Private Sub mciCDPlayer_NextCompleted(ErrorCode As Long)
  232.     ' Set the track number to the new track.
  233.     lblTrack.Caption = Str$(mciCDPlayer.Track)
  234. End Sub
  235. Private Sub mciCDPlayer_PauseClick(Cancel As Integer)
  236.     mciCDPlayer.UpdateInterval = 0
  237.         
  238.     ' Set the "play indicator" to off.
  239.     lblIndicator.BackColor = &H404040
  240. End Sub
  241. Private Sub mciCDPlayer_PlayClick(Cancel As Integer)
  242.     mciCDPlayer.UpdateInterval = 1000
  243.     ' Set the track number to the current track.
  244.     lblTrack.Caption = Str$(mciCDPlayer.Track)
  245. End Sub
  246. Private Sub mciCDPlayer_PrevCompleted(ErrorCode As Long)
  247.     ' Set the track number to new track.
  248.     lblTrack.Caption = Str$(mciCDPlayer.Track)
  249. End Sub
  250. Private Sub mciCDPlayer_StatusUpdate()
  251.     ' Set the track number to the current track.
  252.     lblTrack.Caption = Str$(mciCDPlayer.Track)
  253.     ' Determine if the "play indicator" is off or on,
  254.     ' depending on whether the device is currently playing.
  255.     If mciCDPlayer.Mode = vbMCIModePlay Then
  256.         lblIndicator.BackColor = &H80FF&
  257.     Else
  258.         lblIndicator.BackColor = &H404040
  259.     End If
  260. End Sub
  261. Private Sub mciCDPlayer_StopClick(Cancel As Integer)
  262.     mciCDPlayer.UpdateInterval = 0
  263.     ' Set the "play indicator" to off.
  264.     lblIndicator.BackColor = &H404040
  265.     ' Reset the CD to track 1.
  266.     mciCDPlayer.To = mciCDPlayer.Start
  267.     mciCDPlayer.Command = "Seek"
  268.     mciCDPlayer.Track = 1
  269.     lblTrack.Caption = "1"
  270. End Sub
  271.