home *** CD-ROM | disk | FTP | other *** search
/ Master 95 #1 / MASTER95_1.iso / microsof / vbasic4 / vb4-6.cab / cd.frm (.txt) < prev    next >
Encoding:
Visual Basic Form  |  1995-07-26  |  9.0 KB  |  273 lines

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