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

📄 用multimedia mci 控件_play.frm

📁 个人VB学习源码精选,自己学习时的一些编程小程序,希望对大家有帮助
💻 FRM
字号:
VERSION 5.00
Object = "{831FDD16-0C5C-11D2-A9FC-0000F8754DA1}#2.0#0"; "MSCOMCTL.OCX"
Object = "{C1A8AF28-1257-101B-8FB0-0020AF039CA3}#1.1#0"; "MCI32.OCX"
Object = "{F9043C88-F6F2-101A-A3C9-08002B2F49FB}#1.2#0"; "COMDLG32.OCX"
Begin VB.Form Form1 
   Caption         =   "Form1"
   ClientHeight    =   2070
   ClientLeft      =   165
   ClientTop       =   735
   ClientWidth     =   6570
   LinkTopic       =   "Form1"
   ScaleHeight     =   2070
   ScaleWidth      =   6570
   StartUpPosition =   3  '窗口缺省
   Begin MSComDlg.CommonDialog CommonDialog1 
      Left            =   6075
      Top             =   90
      _ExtentX        =   847
      _ExtentY        =   847
      _Version        =   393216
   End
   Begin MSComctlLib.Slider Slider1 
      Height          =   330
      Left            =   713
      TabIndex        =   2
      TabStop         =   0   'False
      Top             =   495
      Width           =   5145
      _ExtentX        =   9075
      _ExtentY        =   582
      _Version        =   393216
      Enabled         =   0   'False
   End
   Begin MSComctlLib.StatusBar StatusBar1 
      Align           =   2  'Align Bottom
      Height          =   240
      Left            =   0
      TabIndex        =   1
      Top             =   1830
      Width           =   6570
      _ExtentX        =   11589
      _ExtentY        =   423
      _Version        =   393216
      BeginProperty Panels {8E3867A5-8586-11D1-B16A-00C0F0283628} 
         NumPanels       =   5
         BeginProperty Panel1 {8E3867AB-8586-11D1-B16A-00C0F0283628} 
            Object.Width           =   1764
            MinWidth        =   1764
            Text            =   "剩余时间"
            TextSave        =   "剩余时间"
         EndProperty
         BeginProperty Panel2 {8E3867AB-8586-11D1-B16A-00C0F0283628} 
            Object.Width           =   1411
            MinWidth        =   1411
         EndProperty
         BeginProperty Panel3 {8E3867AB-8586-11D1-B16A-00C0F0283628} 
            Object.Width           =   1764
            MinWidth        =   1764
            Text            =   "总时间"
            TextSave        =   "总时间"
         EndProperty
         BeginProperty Panel4 {8E3867AB-8586-11D1-B16A-00C0F0283628} 
            Object.Width           =   1411
            MinWidth        =   1411
         EndProperty
         BeginProperty Panel5 {8E3867AB-8586-11D1-B16A-00C0F0283628} 
            Object.Width           =   4780
            MinWidth        =   4780
         EndProperty
      EndProperty
   End
   Begin MCI.MMControl MMControl1 
      Height          =   330
      Left            =   960
      TabIndex        =   0
      Top             =   1395
      Width           =   4650
      _ExtentX        =   8202
      _ExtentY        =   582
      _Version        =   393216
      DeviceType      =   ""
      FileName        =   ""
   End
   Begin VB.Label Label1 
      Alignment       =   2  'Center
      Height          =   240
      Index           =   2
      Left            =   5220
      TabIndex        =   5
      Top             =   900
      Width           =   645
   End
   Begin VB.Label Label1 
      Alignment       =   2  'Center
      Height          =   240
      Index           =   1
      Left            =   2963
      TabIndex        =   4
      Top             =   900
      Width           =   645
   End
   Begin VB.Label Label1 
      Alignment       =   2  'Center
      Height          =   240
      Index           =   0
      Left            =   630
      TabIndex        =   3
      Top             =   900
      Width           =   645
   End
   Begin VB.Menu mnuFile 
      Caption         =   "File(&F)"
      Begin VB.Menu mnuOpen 
         Caption         =   "Open(&O)"
      End
      Begin VB.Menu mnuClose 
         Caption         =   "Close(&C)"
      End
      Begin VB.Menu mnuExit 
         Caption         =   "Exit(&X)"
      End
   End
End
Attribute VB_Name = "Form1"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Private Sub Form_Load()
    CommonDialog1.Filter = "音乐序器 *.mid|*.mid|波形文件 *.wav|*.wav|Windows 视频 *.avi|*.avi"
    
End Sub

Private Sub MMControl1_Done(NotifyCode As Integer)
    MMControl1.UpdateInterval = 200
End Sub

Private Sub MMControl1_StatusUpdate()
    Static flag As Boolean
    If Right(MMControl1.FileName, 3) = "avi" And Not flag Then
        MMControl1.hWndDisplay = 0
        flag = True
    End If
    On Error GoTo erropen
    MMControl1.TimeFormat = 0
    Slider1.Max = MMControl1.Length / 1000
    If MMControl1.Position <> MMControl1.Length Then
        Slider1.Value = MMControl1.Position / 1000
    Else
        MMControl1.Command = "Prev"
        Slider1.Value = 0
    End If
    StatusBar1.Panels(2) = Tstring(MMControl1.Length - MMControl1.Position)
    StatusBar1.Panels(4) = Tstring(MMControl1.Length)
    Label1(0).Caption = "00:00"
    Label1(1).Caption = Tstring(MMControl1.Length / 2)
    Label1(2).Caption = Tstring(MMControl1.Length)
    Select Case MMControl1.Mode
        Case 524
            StatusBar1.Panels(5) = "未打开设备……"
        Case 525
            StatusBar1.Panels(5) = "停止状态……"
        Case 526
            StatusBar1.Panels(5) = "正在播放……" & CommonDialog1.FileTitle
        Case 527
            StatusBar1.Panels(5) = "正在录音……"
        Case 528
            StatusBar1.Panels(5) = "正在搜索……"
        Case 529
            StatusBar1.Panels(5) = "暂停播放……"
        Case 530
            StatusBar1.Panels(5) = "设备就绪……"
    End Select
erropen:
End Sub

Private Sub mnuClose_Click()
    MMControl1.Command = "Close"
    mnuClose.Enabled = False
End Sub

Private Sub mnuExit_Click()
    MMControl1.Command = "Close"
    End
End Sub

Private Sub mnuOpen_Click()
    CommonDialog1.ShowOpen
    MMControl1.Notify = True
    MMControl1.Wait = True
    MMControl1.Shareable = False
    MMControl1.FileName = CommonDialog1.FileName
    MMControl1.Command = "Open"
    mnuClose.Enabled = True
End Sub
Private Function Tstring(sm As Long) As String
    s = (sm / 1000) \ 60
    m = (sm / 1000) Mod 60
    Tstring = Format(s, "00") & ":" & Format(m, "00")
End Function


⌨️ 快捷键说明

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