音轨总数和播放时间.frm

来自「Windows API函数,希望大伙有用哦」· FRM 代码 · 共 64 行

FRM
64
字号
VERSION 5.00
Begin VB.Form Form1 
   Caption         =   "Form1"
   ClientHeight    =   1005
   ClientLeft      =   60
   ClientTop       =   345
   ClientWidth     =   4950
   LinkTopic       =   "Form1"
   ScaleHeight     =   1005
   ScaleWidth      =   4950
   StartUpPosition =   3  '窗口缺省
   Begin VB.TextBox Text2 
      Alignment       =   1  'Right Justify
      Height          =   305
      Left            =   3090
      TabIndex        =   1
      Text            =   "Text2"
      Top             =   270
      Width           =   1245
   End
   Begin VB.TextBox Text1 
      Alignment       =   1  'Right Justify
      Height          =   285
      Left            =   1260
      TabIndex        =   0
      Text            =   "Text1"
      Top             =   270
      Width           =   495
   End
   Begin VB.Label Label2 
      AutoSize        =   -1  'True
      Caption         =   "播放时间:"
      Height          =   180
      Left            =   2100
      TabIndex        =   3
      Top             =   330
      Width           =   900
   End
   Begin VB.Label Label1 
      AutoSize        =   -1  'True
      Caption         =   "音轨总数:"
      Height          =   180
      Left            =   330
      TabIndex        =   2
      Top             =   330
      Width           =   900
   End
End
Attribute VB_Name = "Form1"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit
Private Declare Function mciSendString Lib "winmm.dll" Alias "mciSendStringA" (ByVal lpstrCommand As String, ByVal lpstrReturnString As String, ByVal uReturnLength As Long, ByVal hwndCallback As Long) As Long
Dim S As String * 256
Private Sub Form_Load()
    mciSendString "Open cdaudio alias CDRom", vbNullString, 0, 0
    mciSendString "Status CDRom number of tracks", S, Len(S), 0
    Text1 = Val(S)
    mciSendString "Status CDRom length", S, Len(S), 0
    Text2 = S
End Sub

⌨️ 快捷键说明

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