media.frm

来自「两个VB播放器 两个VB播放器 两个VB播放器 两个VB播放器」· FRM 代码 · 共 1,125 行 · 第 1/3 页

FRM
1,125 行
字号
      Height          =   5280
      ItemData        =   "Media.frx":13B142
      Left            =   3600
      List            =   "Media.frx":13B144
      MultiSelect     =   2  'Extended
      TabIndex        =   0
      Top             =   480
      Width           =   6615
   End
   Begin VB.Image Image1 
      Height          =   3750
      Left            =   0
      Picture         =   "Media.frx":13B146
      Stretch         =   -1  'True
      Top             =   5640
      Width           =   10500
   End
   Begin VB.Label Label10 
      AutoSize        =   -1  'True
      BackStyle       =   0  'Transparent
      Caption         =   "Label10"
      Height          =   300
      Left            =   4080
      TabIndex        =   4
      Top             =   5880
      Width           =   1110
   End
   Begin VB.Label Label6 
      BackColor       =   &H80000008&
      BorderStyle     =   1  'Fixed Single
      Caption         =   "                                                                                          文件名"
      BeginProperty Font 
         Name            =   "宋体"
         Size            =   10.5
         Charset         =   134
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      ForeColor       =   &H0000C000&
      Height          =   615
      Left            =   3600
      TabIndex        =   2
      Top             =   0
      Width           =   6615
   End
   Begin VB.Menu meuTvw 
      Caption         =   "TreeView"
      Visible         =   0   'False
      Begin VB.Menu meuFore 
         Caption         =   "前插入结点"
      End
      Begin VB.Menu meuBack 
         Caption         =   "后插入结点"
      End
      Begin VB.Menu line6 
         Caption         =   "-"
      End
      Begin VB.Menu meuNew 
         Caption         =   "新建子结点(&N)"
         Shortcut        =   ^N
      End
      Begin VB.Menu meuDel 
         Caption         =   "移除结点(&D)"
         Shortcut        =   ^D
      End
      Begin VB.Menu line1 
         Caption         =   "-"
      End
      Begin VB.Menu meuEdite 
         Caption         =   "编辑该列表(&E)"
      End
      Begin VB.Menu meuPlay 
         Caption         =   "播放此列表(&P)"
         Shortcut        =   ^P
      End
      Begin VB.Menu line2 
         Caption         =   "-"
      End
      Begin VB.Menu meuNewName 
         Caption         =   "重命名此结点(&M)"
      End
      Begin VB.Menu meuAdd 
         Caption         =   "添加结点文件(&F)"
      End
      Begin VB.Menu line3 
         Caption         =   "-"
      End
      Begin VB.Menu meuSave 
         Caption         =   "保存更改(&S)"
         Shortcut        =   ^S
      End
      Begin VB.Menu meuExit 
         Caption         =   "退出(&Q)"
      End
   End
   Begin VB.Menu meuList 
      Caption         =   "list"
      Visible         =   0   'False
      Begin VB.Menu meuPlayer 
         Caption         =   "播放(P)"
      End
      Begin VB.Menu meuListen 
         Caption         =   "视听此文件(&L)"
      End
      Begin VB.Menu line4 
         Caption         =   "-"
      End
      Begin VB.Menu meuAllSelect 
         Caption         =   "全选(&A)"
         Shortcut        =   ^A
      End
      Begin VB.Menu meuPause 
         Caption         =   "暂停播放(&P)"
      End
   End
End
Attribute VB_Name = "Form6"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
'Private Declare Function SendMessage Lib "user32" Alias "SendMessageA" (ByVal hwnd As Long, ByVal wMsg As Long, ByVal wParam As Long, lParam As Any) As Long
'Private Declare Function GetWindowLong Lib "user32" Alias "GetWindowLongA" (ByVal hwnd As Long, ByVal nIndex As Long) As Long
'Private Declare Function SetWindowLong Lib "user32" Alias "SetWindowLongA" (ByVal hwnd As Long, ByVal nIndex As Long, ByVal dwNewLong As Long) As Long
'Private Declare Function GetSysColor Lib "user32" (ByVal nIndex As Long) As Long
'Private Const GWL_STYLE = (-16)
'Private Const COLOR_WINDOW = 5
'Private Const COLOR_WINDOWTEXT = 8
'Private Const TVS_HASLINES As Long = 2
'Private Const TV_FIRST As Long = &H100
'Private Const TVM_SETBKCOLOR As Long = (TV_FIRST + 29)
'Private Const TVM_SETTEXTCOLOR As Long = (TV_FIRST + 30)
'Private Const TVM_GETBKCOLOR As Long = (TV_FIRST + 31)
'Private Const TVM_GETTEXTCOLOR As Long = (TV_FIRST + 32)

 'Private Function gettvbackcolour() As Long
    'Dim clrref As Long
   ' Dim hwndtv As Long
   ' hwndtv = TreeView1.hwnd
   ' clrref = SendMessage(hwndtv, TVM_GETBKCOLOR, 0, ByVal 0)
    'If crref = -1 Then
     '  clrref = GetSysColor(COLOR_WINDOW)
    'End If
    'gettvforecolour = clrref
 'End Function
 'Private Sub settvbackcolour(clrref As Long)
  '  Dim hwndtv As Long
   ' Dim style As Long
    'hwndtv = TreeView1.hwnd
    'Call SendMessage(hwndtv, TVM_setbkclor, 0, ByVal clrref)
    'style = GetWindowLong(TreeView1.hwnd, GWL_STYLE)
  '  If style And TVS_HASLINES Then
   '      Call SetWindowLong(hwndtv, GWL_STYLE, style Xor TVS_HASLINES)
    ''     Call SetWindowLong(hwndtv, GWL_STYLE, style)
   ' End If
' End Sub
''Private Sub settvforecolour(clrref As Long)
  '  Dim hwndtv As Long
   ' Dim style As Long
    'hwndtv = TreeView1.hwnd
    'C'all SendMessage(hwndtv, TVM_SETTEXTCOLOR, 0, ByVal clrref)
   ' style = GetWindowLong(TreeView1.hwnd, GWL_STYLE)
    'If style And TVS_HASLINES Then
     '    Call SetWindowLong(hwndtv, GWL_STYLE, style Xor TVS_HASLINES)
      '   Call SetWindowLong(hendtv, GWL_STYLE, style)
    'End' If
'End Sub


Sub savefile(strFile As String)
  Dim ndroot As Node
  Dim ifilenum As Integer                                     '//保存文件
  Set ndroot = TreeView1.Nodes.item(1)
  Open strFile For Output As #1
    Print #1, ndroot.Text & ","
    If (ndroot.Children > 0) Then
       writechildrentofile ndroot, ndroot.Children, ifilenum
    End If
  Close #1
End Sub

Sub writechildrentofile(ndnode As Node, inumberofchildren, ifilenum As Integer)
  Dim icounter As Integer
  Dim ndtempnode As Node                                       '//将结点写入文件
  Set ndtempnode = ndnode.Child
  For icounter = 1 To inumberofchildren
      Print #1, ndtempnode.Text & "," & ndtempnode.Parent.Text
      If (ndtempnode.Children > 0) Then
         writechildrentofile ndtempnode, ndtempnode.Children, 1
      End If
      Set ndtempnode = ndtempnode.Next
  Next icounter
End Sub

Sub addrnode(smanagern As String, int_1 As Integer)
    Dim ndnewnode As Node
    Set ndnewnode = TreeView1.Nodes.Add(, , smanagern, smanagern, int_1)   '//添加父结点
End Sub

Sub addnode(strteammname As String, smanagern As String, int_2 As Integer)            '//添加子结点
  Dim ndnewnode As Node
  Set ndnewnode = TreeView1.Nodes.Add(smanagern, tvwChild, strteammname, strteammname, int_2)
End Sub



Private Sub cmdAddFile_Click()
 On Error GoTo label
 If TreeView1.SelectedItem <> "" Then
   Dialog8.Show
 End If
   Exit Sub
label:   MsgBox "请先选中一个结点", vbExclamation + vbOKOnly, "警告"
End Sub

Private Sub cmdAddNode_Click()
   'On Error Resume Next
   Dim ndtemp As Node
   Dim strmname As String                                         '//添加新结点
   On Error GoTo errhandler
   strmname = InputBox("请输入新结点名", "添加结点", "新建结点")
   If strmname = "" Then Exit Sub
   Set ndtemp = TreeView1.Nodes.Add(TreeView1.SelectedItem.Text, tvwChild, strmname, strmname, 15)
   Form6.TreeView1.SelectedItem.Expanded = True
   Exit Sub
errhandler:
     Resume exitlabel
exitlabel:
End Sub

Private Sub cmdDel_Click()
   On Error GoTo label
   Dim Dir1 As String
   Dim msg As String
   msg = MsgBox("你确定要移除" & TreeView1.SelectedItem.Text & "这个结点吗?", vbInformation + vbYesNo, "询问")
   If msg = vbYes Then
     TreeView1.Nodes.Remove TreeView1.SelectedItem.Key
     Dir1 = Dir(App.Path & "\temp\" & TreeView1.SelectedItem.Text & ".m3u")
     If Dir1 <> "" Then
         Kill App.Path & "\temp\" & TreeView1.SelectedItem.Text & ".m3u"
     End If
   ElseIf msg = vbNo Then
      DoEvents
   End If
   Exit Sub
label:    MsgBox "请先选中一个结点", vbExclamation + vbOKOnly, "警告"
End Sub

Private Sub cmdEdite_Click()
 On Error GoTo label
 Dim Dir_1
 Dir_1 = Dir(App.Path & "\temp\" & TreeView1.SelectedItem.Text & ".m3u")
  If TreeView1.SelectedItem <> "" And Dir_1 <> "" Then
   Dialog7.Show
  End If
   Exit Sub
label:   MsgBox "请先选中一个结点", vbExclamation + vbOKOnly, "警告"
End Sub

Private Sub cmdExit_Click()
   Dim ndsample As Node
   Dim retval As Integer                                 '//保存结点内容
   Dim strfilen As String
   strfilen = App.Path & "\temp\Save_Nodes.nod"
   savefile strfilen
  Unload Form6
  Set Form6 = Nothing
End Sub

Private Sub cmdNewName_Click()
  On Error Resume Next
  Dim Dir_1 As String
  Dim strNewName As String
  Dim msg As String
  Err.Clear
  Dir_1 = Dir(App.Path & "\temp\" & TreeView1.SelectedItem & ".m3u")
  If Err.Number <> 0 Then
    GoTo label
  End If
  Err.Clear
  If Dir_1 = "" Then
    MsgBox "此结点无可用文件,不可重命名", vbOKOnly + vbExclamation, "提示"
  Else
    strNewName = InputBox("请输入新的结点名", "重命名", TreeView1.SelectedItem.Text)
    If strNewName = "" Then
        Exit Sub
    Else
        msg = MsgBox("你确定要重命名" & TreeView1.SelectedItem.Text & "这个结点吗", vbYesNo + vbInformation, "询问")
     If msg = vbYes Then
        Name App.Path & "\temp\" & TreeView1.SelectedItem.Text & ".m3u" As App.Path & "\temp\" & strNewName & ".m3u"
        TreeView1.SelectedItem.Text = strNewName
        Exit Sub
     ElseIf msg = vbNo Then
       DoEvents
       Exit Sub
     End If
   End If
  End If
  Exit Sub
label: MsgBox "请先选中一个结点", vbExclamation + vbOKOnly, "警告"
 
End Sub

Private Sub cmdPlay_Click()
  On Error Resume Next
  Dim index As Integer
  Dim i As Integer
 
If List1.List(0) <> "" Then                 '//卸载菜单
   For i = 0 To 50
     Form1.meu(i).Checked = False
     Unload Form1.meu(i)
   Next
 For x = 0 To 24
     Form1.Label8(x).Enabled = False
 Next x
 If List1.SelCount <> 0 Then
   i = 0
   For index = 0 To List1.ListCount - 1
     If List1.Selected(index) Then         '//将选中文件播放
         i = i + 1
         With Form1.MMControl1
            .Command = "Stop"
            .Command = "Close"
         Form1.meuPlayFile.Visible = True
         Form1.meuPlayList.Visible = False
         Form1.meuMusic.Visible = False
         Form1.meuCDQuMu.Visible = False
         Load Form1.meu(i)
         Form1.Label8(i - 1).Enabled = True
         Form1.meu(i).Caption = List1.List(index)
         'Debug.Print Form1.meu(i).Caption
        End With
     End If
   Next index
   Form1.Label2.Caption = "曲目总数: " & i
 Else
  For index = 0 To List1.ListCount - 1             '//全部播放
         With Form1.MMControl1
            .Command = "Stop"
            .Command = "Close"
         Form1.Label8(index).Enabled = True
         Form1.meuPlayFile.Visible = True
         Form1.meuPlayList.Visible = False
         Form1.meuMusic.Visible = False
         Form1.meuCDQuMu.Visible = False
         Load Form1.meu(index + 1)
         Form1.meu(index + 1).Caption = List1.List(index)
        End With
   Next index
   Form1.Label2.Caption = "曲目总数: " & List1.ListCount
 End If
  Form1.MMControl1.FileName = Form1.meu(1).Caption
  Form1.MMControl1.Command = "Open"
  Form1.MMControl1.Command = "Play"
  Form1.MMControl1.UpdateInterval = 1000
  Form1.meu(1).Checked = True
  If Form1.MMControl1.Mode <> 526 Then
      MsgBox "未装声卡或驱动程序未正确安装或未加载", vbInformation + vbOKOnly, "提示"
  End If
  Unload Form6
  Set Form6 = Nothing
End If
End Sub

Private Sub Command3_Click()

End Sub

Private Sub Command1_Click()
  MCI.Command = "Pause"
End Sub

⌨️ 快捷键说明

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