⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 cdplayer.frm

📁 Visual Basic 6 大学教程的代码
💻 FRM
字号:
VERSION 5.00
Object = "{C1A8AF28-1257-101B-8FB0-0020AF039CA3}#1.1#0"; "MCI32.OCX"
Begin VB.Form CDPlayer 
   BorderStyle     =   1  'Fixed Single
   Caption         =   "CD Player"
   ClientHeight    =   1785
   ClientLeft      =   45
   ClientTop       =   330
   ClientWidth     =   3720
   LinkTopic       =   "Form1"
   MaxButton       =   0   'False
   MinButton       =   0   'False
   ScaleHeight     =   1785
   ScaleWidth      =   3720
   StartUpPosition =   3  'Windows Default
   Begin VB.TextBox txtCurrentTrack 
      Enabled         =   0   'False
      Height          =   285
      Left            =   1320
      TabIndex        =   6
      Top             =   720
      Width           =   2295
   End
   Begin VB.TextBox txtTrackLength 
      Enabled         =   0   'False
      Height          =   285
      Left            =   1320
      TabIndex        =   5
      Top             =   1080
      Width           =   2295
   End
   Begin VB.TextBox txtTotalTracks 
      Enabled         =   0   'False
      Height          =   285
      Left            =   1320
      TabIndex        =   4
      Top             =   1440
      Width           =   2295
   End
   Begin MCI.MMControl MMControl1 
      Height          =   450
      Left            =   120
      TabIndex        =   0
      Top             =   120
      Width           =   3540
      _ExtentX        =   6244
      _ExtentY        =   794
      _Version        =   393216
      DeviceType      =   ""
      FileName        =   ""
   End
   Begin VB.Label lblTotalTracks 
      Caption         =   "Total Tracks:"
      Height          =   255
      Left            =   120
      TabIndex        =   3
      Top             =   1440
      Width           =   1215
   End
   Begin VB.Label lblTrackLength 
      Caption         =   "Track Length:"
      Height          =   255
      Left            =   120
      TabIndex        =   2
      Top             =   1110
      Width           =   1215
   End
   Begin VB.Label lblCurrentTrack 
      Caption         =   "Current Track:"
      Height          =   255
      Left            =   120
      TabIndex        =   1
      Top             =   750
      Width           =   1215
   End
End
Attribute VB_Name = "CDPlayer"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
' Fig. 20.7
' Using the Microsoft Multimedia MCI Control
' as an audio CD player.
Option Explicit

Private Sub Form_Load()
   MMControl1.Notify = False
   MMControl1.Wait = True
   MMControl1.Shareable = False
   MMControl1.DeviceType = "CDAudio"
   
   MMControl1.Command = "Open"
   txtTotalTracks.Text = Format$(MMControl1.Tracks, "00")
End Sub

Private Sub Form_Unload(Cancel As Integer)
   MMControl1.Command = "Stop"
   MMControl1.Command = "Close"
End Sub

Private Sub MMControl1_NextCompleted(Errorcode As Long)
   Call UpdateInformation
End Sub

Private Sub MMControl1_PrevCompleted(Errorcode As Long)
   Call UpdateInformation
End Sub

Private Sub MMControl1_StatusUpdate()
   Call UpdateInformation
End Sub

Private Sub UpdateInformation()
   Dim min1 As Integer, min2 As Integer
   Dim sec1 As Integer, sec2 As Integer
   
   txtCurrentTrack.Text = Format$(MMControl1.Track, "00")
   txtTrackLength.Text = _
      Format$(MMControl1.TrackLength And &HFF, "00") & ":" & _
      Format$((MMControl1.TrackLength And &HFF00) \ &H10000, _
              "00")
End Sub

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -