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

📄 form1.frm

📁 VB源码,是初学者的福因.让你很快掌握VB编程
💻 FRM
📖 第 1 页 / 共 2 页
字号:
VERSION 5.00
Object = "{F9043C88-F6F2-101A-A3C9-08002B2F49FB}#1.2#0"; "COMDLG32.OCX"
Begin VB.Form Form1 
   BackColor       =   &H00400000&
   Caption         =   "Evan's CD Player"
   ClientHeight    =   3300
   ClientLeft      =   165
   ClientTop       =   450
   ClientWidth     =   8445
   ForeColor       =   &H00000000&
   Icon            =   "Form1.frx":0000
   LinkTopic       =   "Form1"
   MaxButton       =   0   'False
   ScaleHeight     =   3300
   ScaleWidth      =   8445
   StartUpPosition =   3  '窗口缺省
   Begin VB.Timer Timer2 
      Left            =   8280
      Top             =   3120
   End
   Begin VB.ComboBox TrackSelection 
      BackColor       =   &H00000000&
      BeginProperty Font 
         Name            =   "MS Sans Serif"
         Size            =   13.5
         Charset         =   0
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      ForeColor       =   &H80000004&
      Height          =   480
      Left            =   4680
      TabIndex        =   11
      Top             =   2520
      Width           =   735
   End
   Begin MSComDlg.CommonDialog CommonDialog1 
      Left            =   7560
      Top             =   3720
      _ExtentX        =   847
      _ExtentY        =   847
      _Version        =   393216
   End
   Begin VB.VScrollBar Volume 
      Height          =   1455
      Left            =   7920
      MousePointer    =   4  'Icon
      TabIndex        =   12
      Top             =   1560
      Width           =   255
   End
   Begin VB.CommandButton Exit 
      Caption         =   "Exit"
      Height          =   615
      Left            =   6960
      TabIndex        =   10
      Top             =   960
      Width           =   855
   End
   Begin VB.CommandButton Close 
      Caption         =   "Close"
      Height          =   615
      Left            =   6000
      TabIndex        =   9
      Top             =   960
      Width           =   855
   End
   Begin VB.TextBox TimeWindow 
      Alignment       =   2  'Center
      BackColor       =   &H00000000&
      Enabled         =   0   'False
      BeginProperty Font 
         Name            =   "Arial"
         Size            =   24
         Charset         =   0
         Weight          =   700
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      ForeColor       =   &H80000002&
      Height          =   735
      Left            =   360
      TabIndex        =   7
      TabStop         =   0   'False
      ToolTipText     =   "Time"
      Top             =   240
      Width           =   2535
   End
   Begin VB.CommandButton Play 
      Caption         =   "Play"
      Enabled         =   0   'False
      Height          =   615
      Left            =   3120
      TabIndex        =   0
      ToolTipText     =   "Play"
      Top             =   240
      Width           =   855
   End
   Begin VB.CommandButton Pause 
      Caption         =   "Pause"
      Enabled         =   0   'False
      Height          =   615
      Left            =   4080
      TabIndex        =   1
      ToolTipText     =   "Pause"
      Top             =   240
      Width           =   855
   End
   Begin VB.CommandButton stpButton 
      Caption         =   "Stop"
      Enabled         =   0   'False
      Height          =   615
      Left            =   5040
      TabIndex        =   2
      ToolTipText     =   "Stop"
      Top             =   240
      Width           =   855
   End
   Begin VB.CommandButton PreviousTrack 
      Caption         =   "Previous Track"
      Enabled         =   0   'False
      Height          =   615
      Left            =   3120
      TabIndex        =   5
      ToolTipText     =   "Back One Song"
      Top             =   960
      Width           =   855
   End
   Begin VB.CommandButton NextTrack 
      Caption         =   "Next Track"
      Enabled         =   0   'False
      Height          =   615
      Left            =   4080
      TabIndex        =   6
      ToolTipText     =   "Forward One Song"
      Top             =   960
      Width           =   855
   End
   Begin VB.CommandButton Rewind 
      Caption         =   "Rewind"
      Enabled         =   0   'False
      Height          =   615
      Left            =   6000
      TabIndex        =   3
      ToolTipText     =   "Rewind"
      Top             =   240
      Width           =   855
   End
   Begin VB.CommandButton FastForward 
      Caption         =   "Fast Forward"
      Enabled         =   0   'False
      Height          =   615
      Left            =   6960
      TabIndex        =   4
      ToolTipText     =   "Fast Forward"
      Top             =   240
      Width           =   855
   End
   Begin VB.CommandButton Eject 
      Caption         =   "Open"
      Enabled         =   0   'False
      Height          =   615
      Left            =   5040
      TabIndex        =   8
      ToolTipText     =   "Eject CD"
      Top             =   960
      Width           =   855
   End
   Begin VB.Timer Timer1 
      Enabled         =   0   'False
      Interval        =   1000
      Left            =   7080
      Top             =   3720
   End
   Begin VB.Label lblTrackSelection 
      BackColor       =   &H00400000&
      Caption         =   "Track Number"
      BeginProperty Font 
         Name            =   "MS Sans Serif"
         Size            =   24
         Charset         =   0
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      ForeColor       =   &H80000004&
      Height          =   495
      Left            =   1440
      TabIndex        =   16
      Top             =   2520
      Visible         =   0   'False
      Width           =   3135
   End
   Begin VB.Label lblVolume 
      BackColor       =   &H00400000&
      Caption         =   "Volume"
      BeginProperty Font 
         Name            =   "MS Sans Serif"
         Size            =   24
         Charset         =   0
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      ForeColor       =   &H80000004&
      Height          =   615
      Left            =   6120
      TabIndex        =   15
      Top             =   2520
      Visible         =   0   'False
      Width           =   1695
   End
   Begin VB.Label TotalTrack 
      BackColor       =   &H80000006&
      BorderStyle     =   1  'Fixed Single
      BeginProperty Font 
         Name            =   "MS Sans Serif"
         Size            =   13.5
         Charset         =   0
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      ForeColor       =   &H80000004&
      Height          =   375
      Left            =   360
      TabIndex        =   14
      Top             =   1800
      Width           =   3975
   End
   Begin VB.Label TrackTime 
      BackColor       =   &H00000000&
      BorderStyle     =   1  'Fixed Single
      BeginProperty Font 
         Name            =   "MS Sans Serif"
         Size            =   13.5
         Charset         =   0
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      ForeColor       =   &H80000004&
      Height          =   375
      Left            =   4560
      TabIndex        =   13
      Top             =   1800
      Width           =   2655
   End
End
Attribute VB_Name = "Form1"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Private Declare Function FlashWindow Lib "user32" (ByVal hwnd As Long, ByVal bInvert As Long) As Long

Dim FastForwardSpeed As Long        ' seconds to seek for ff/rew
Dim Playing As Boolean                ' true if CD is currently playing
Dim CDLoad As Boolean                  ' true if CD is the the player
Dim TotalTracks As Integer              ' total tracks tracks on audio CD
Dim TrackLength() As String              ' array containing length of each track
Dim Track As Integer                     ' current track
Dim Minute As Integer                   ' current minute on track
Dim Second As Integer                  ' current second on track
Dim Command As String                 ' string to hold mci command strings
Dim hmixer As Long                   ' mixer handle
Dim volCtrl As MIXERCONTROL         ' Waveout volume control.

              
'Option Explicit

' Send a MCI command string
' If fShowError is true, display a message box on error
Private Function SendMCIString(Cmd As String, fShowError As Boolean) As Boolean
Static rc As Long               'return code
Static errStr As String * 400

rc = mciSendString(Cmd, 0, 0, hwnd)
If (fShowError And rc <> 0) Then
    mciGetErrorString rc, errStr, Len(errStr)
    MsgBox errStr
End If
SendMCIString = (rc = 0)
End Function

Private Sub Close_Click()
SendMCIString "set cd door closed", True
Update
End Sub

Private Sub Command1_Click()
Form2.Show
End Sub

Private Sub Exit_Click()
End
End Sub

Private Sub Form_Load()
Dim rc  As Long
Dim OK As Boolean
' Open the mixer with deviceID 0.

⌨️ 快捷键说明

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