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

📄 mp3msg.frm

📁 这个播放器是自己做的
💻 FRM
字号:
VERSION 5.00
Begin VB.Form Form18 
   BorderStyle     =   0  'None
   Caption         =   "Form18"
   ClientHeight    =   645
   ClientLeft      =   150
   ClientTop       =   540
   ClientWidth     =   4680
   LinkTopic       =   "Form18"
   LockControls    =   -1  'True
   MaxButton       =   0   'False
   MinButton       =   0   'False
   ScaleHeight     =   645
   ScaleWidth      =   4680
   ShowInTaskbar   =   0   'False
   StartUpPosition =   3  '窗口缺省
   Begin VB.Timer Timer1 
      Left            =   1800
      Top             =   120
   End
   Begin VB.PictureBox Picture2 
      AutoSize        =   -1  'True
      BorderStyle     =   0  'None
      Height          =   375
      Left            =   2400
      ScaleHeight     =   375
      ScaleWidth      =   735
      TabIndex        =   1
      Top             =   240
      Width           =   735
   End
   Begin VB.PictureBox Picture1 
      AutoRedraw      =   -1  'True
      AutoSize        =   -1  'True
      BorderStyle     =   0  'None
      Height          =   495
      Left            =   0
      ScaleHeight     =   33
      ScaleMode       =   3  'Pixel
      ScaleWidth      =   89
      TabIndex        =   0
      Top             =   0
      Width           =   1335
      Begin VB.Image Image1 
         Height          =   375
         Left            =   0
         Top             =   0
         Width           =   375
      End
      Begin VB.Label Label2 
         AutoSize        =   -1  'True
         BackStyle       =   0  'Transparent
         BeginProperty Font 
            Name            =   "Arial"
            Size            =   10.5
            Charset         =   0
            Weight          =   400
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   240
         Left            =   120
         TabIndex        =   3
         Top             =   240
         Width           =   60
      End
      Begin VB.Label Label1 
         AutoSize        =   -1  'True
         BackStyle       =   0  'Transparent
         Caption         =   "00:00"
         BeginProperty Font 
            Name            =   "Arial"
            Size            =   10.5
            Charset         =   0
            Weight          =   400
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   240
         Left            =   0
         TabIndex        =   2
         Top             =   0
         Width           =   540
      End
   End
   Begin VB.Menu mp3 
      Caption         =   "mp3"
      Visible         =   0   'False
      Begin VB.Menu showmain 
         Caption         =   "显示主界面"
      End
      Begin VB.Menu play 
         Caption         =   "播放"
         Enabled         =   0   'False
      End
      Begin VB.Menu pause 
         Caption         =   "暂停"
         Enabled         =   0   'False
      End
      Begin VB.Menu MSTOP 
         Caption         =   "停止"
         Enabled         =   0   'False
      End
   End
End
Attribute VB_Name = "Form18"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit
Dim Meskin As String

Private Sub Form_Load()

Dim n As Long
Dim str1 As String
Dim i As Integer
str1 = String(255, 0)
Meskin = "红粉菲菲"
ShowTitleBar Form18, False
Me.Left = Screen.Width - Me.Width - 150
Me.Top = 10
Picture1.Picture = LoadPicture(App.Path & "\mp3\msgbg.gif")
Me.Width = Picture1.Width
Me.Height = Picture1.Height
n = PicProc(Picture1)
SetWindowRgn Me.hwnd, n, True
With Image1
  If Form11.wmp.playState = 0 Or Form11.wmp.playState = 1 Then
    .Picture = LoadPicture(App.Path & "\mp3\msgstate1.gif")
    play.Enabled = True
  ElseIf Form11.wmp.playState = 2 Then
    play.Enabled = True
    MSTOP.Enabled = True
    Label1.Caption = Form11.wmp.Controls.currentPositionString
    Label2.Caption = Form11.wmp.Controls.currentItem.Name
    If Len(Label2.Caption) > 4 Then
      Label2.Caption = Left(Label2.Caption, 4) + ".."
    End If
    .Picture = LoadPicture(App.Path & "\mp3\msgstate2.gif")
    Timer1.Interval = 500
  ElseIf Form11.wmp.playState = 3 Then
    pause.Enabled = True
    MSTOP.Enabled = True
    Label1.Caption = Form11.wmp.Controls.currentPositionString
    Label2.Caption = Form11.wmp.Controls.currentItem.Name
    If Len(Label2.Caption) > 4 Then
      Label2.Caption = Left(Label2.Caption, 4) + ".."
    End If
    .Picture = LoadPicture(App.Path & "\mp3\msgstate3.gif")
    Timer1.Interval = 500
  End If
  GetPrivateProfileString "msgstate", "left", "", str1, 256, App.Path & "\mp3\mp3option.ini"
  .Left = Val(str1)
  GetPrivateProfileString "msgstate", "top", "", str1, 256, App.Path & "\mp3\mp3option.ini"
  .Top = Val(str1)
End With
With Picture2
  .Picture = LoadPicture(App.Path & "\mp3\msgdown1.gif")
  GetPrivateProfileString "msgdown", "left", "", str1, 256, App.Path & "\mp3\mp3option.ini"
  .Left = Val(str1)
  GetPrivateProfileString "msgdown", "top", "", str1, 256, App.Path & "\mp3\mp3option.ini"
  .Top = Val(str1)
End With
With Label2
  GetPrivateProfileString "msgname", "left", "", str1, 256, App.Path & "\mp3\mp3option.ini"
  .Left = Val(str1)
  GetPrivateProfileString "msgname", "top", "", str1, 256, App.Path & "\mp3\mp3option.ini"
  .Top = Val(str1)
End With
With Label1
  GetPrivateProfileString "msgtimer", "left", "", str1, 256, App.Path & "\mp3\mp3option.ini"
  .Left = Val(str1)
  GetPrivateProfileString "msgtimer", "top", "", str1, 256, App.Path & "\mp3\mp3option.ini"
  .Top = Val(str1)
End With

End Sub

Private Sub MSTOP_Click()

With Form11
  .wmp.Controls.Stop
  .Stopmig.Enabled = False
  .Nextmig.Enabled = False
  .Qianmig.Enabled = False
  .Statemig1.Picture = LoadPicture(App.Path & "\mp3\state1-2.gif")
  .Statemig2.Picture = LoadPicture(App.Path & "\mp3\state2-2.gif")
  .Statemig3.Picture = LoadPicture(App.Path & "\mp3\state3-1.gif")
  .Playmig.Picture = LoadPicture(App.Path & "\mp3\play1.gif")
  .Dangmig.Left = .Dangleft
  .Jingmig.Width = 15
  .MusicIndex = 1
End With
play.Enabled = True
pause.Enabled = False
MSTOP.Enabled = False
Image1.Picture = LoadPicture(App.Path & "\mp3\msgstate1.gif")

End Sub

Private Sub pause_Click()
    
With Form11
    .Statemig1.Picture = LoadPicture(App.Path & "\mp3\state1-2.gif")
    .Statemig2.Picture = LoadPicture(App.Path & "\mp3\state2-1.gif")
    .Statemig3.Picture = LoadPicture(App.Path & "\mp3\state3-2.gif")
    .wmp.Controls.pause
    .Playmig.Picture = LoadPicture(App.Path & "\mp3\play1.gif")
    pause.Enabled = False
    play.Enabled = True
End With
Image1.Picture = LoadPicture(App.Path & "\mp3\msgstate2.gif")

End Sub

Private Sub Picture1_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)

If Button = 1 Then
  ReleaseCapture
  SendMessage Me.hwnd, WM_NCLBUTTONDOWN, HTCAPTION, 0&
End If

End Sub

Private Sub Picture1_MouseUp(Button As Integer, Shift As Integer, X As Single, Y As Single)

If Button = 2 Then
  PopupMenu mp3
End If

End Sub

Private Sub Picture2_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)

Static Onmig As Boolean
With Picture2
'模拟MouseOut事件
  If (X < 0) Or (Y < 0) Or (X > .Width) Or (Y > .Height) Then
    ReleaseCapture
    Onmig = False
    Set .Picture = LoadPicture(App.Path & "\mp3\msgdown1.gif")
  Else
    SetCapture .hwnd
    If Onmig = False Then
      Set .Picture = LoadPicture(App.Path & "\mp3\msgdown2.gif")
      Onmig = True
    End If
  End If
End With

End Sub

Private Sub Picture2_MouseUp(Button As Integer, Shift As Integer, X As Single, Y As Single)

If Button = 1 Then
  Me.Hide
  Form11.Show
  Form16.Show
  Form16.Left = Form11.Left + Form11.Meleft
  Form16.Top = Form11.Top + Form11.Metop
  Form11.Showlistmig.Picture = LoadPicture(App.Path & "\mp3\bottom1.gif")
End If

End Sub

Private Sub play_Click()

On Error GoTo er
With Form11
Select Case .wmp.playState
  Case 0
    .cd1.ShowOpen
    .wmp.URL = .cd1.FileName
    .Stopmig.Enabled = True
    .Playmig.Enabled = True
    .Statemig1.Picture = LoadPicture(App.Path & "\mp3\state1-1.gif")
    .Statemig2.Picture = LoadPicture(App.Path & "\mp3\state2-2.gif")
    .Statemig3.Picture = LoadPicture(App.Path & "\mp3\state3-2.gif")
    .Playmig.Picture = LoadPicture(App.Path & "\mp3\pause1.gif")
    .Timer1.Interval = 500
    Timer1.Interval = 500
    MSTOP.Enabled = True
    pause.Enabled = True
    play.Enabled = False
    .sta = True
    Image1.Picture = LoadPicture(App.Path & "\mp3\msgstate3.gif")
    Form16.ListView1.ListItems.Add , , .cd1.FileTitle
    Form16.ListView1.ListItems.Item(1).ListSubItems(1) = .cd1.FileName
  Case 1
    .Statemig1.Picture = LoadPicture(App.Path & "\mp3\state1-1.gif")
    .Statemig2.Picture = LoadPicture(App.Path & "\mp3\state2-2.gif")
    .Statemig3.Picture = LoadPicture(App.Path & "\mp3\state3-2.gif")
    .Playmig.Picture = LoadPicture(App.Path & "\mp3\pause1.gif")
    If Form16.ListView1.ListItems.Count <> 0 Then
      .wmp.URL = Form16.ListView1.ListItems.Item(1).SubItems(1)
      .MusicIndex = 1
      .sta = True
    Else
      .wmp.Controls.play
    End If
    MSTOP = True
    play.Enabled = False
    pause.Enabled = True
    .Stopmig.Enabled = True
    .Timer1.Interval = 500
    Timer1.Interval = 500
    Image1.Picture = LoadPicture(App.Path & "\mp3\msgstate3.gif")
  Case 2
    .Statemig1.Picture = LoadPicture(App.Path & "\mp3\state1-1.gif")
    .Statemig2.Picture = LoadPicture(App.Path & "\mp3\state2-2.gif")
    .Statemig3.Picture = LoadPicture(App.Path & "\mp3\state3-2.gif")
    .Playmig.Picture = LoadPicture(App.Path & "\mp3\pause1.gif")
    .wmp.Controls.play
    Timer1.Interval = 500
    pause.Enabled = True
    play.Enabled = False
    Image1.Picture = LoadPicture(App.Path & "\mp3\msgstate3.gif")
End Select
End With
Exit Sub
er:

End Sub

Private Sub showmain_Click()

Unload Me
Form11.Show

End Sub

Private Sub Timer1_Timer()

With Form11
If .wmp.playState = 3 Then
  Label1.Caption = .wmp.Controls.currentPositionString
    Label2.Caption = Form11.wmp.Controls.currentItem.Name
    If Len(Label2.Caption) > 4 Then
      Label2.Caption = Left(Label2.Caption, 4) + ".."
    End If
ElseIf .wmp.playState = 1 Then
  If Form16.ListView1.ListItems.Count <= 1 Or Form16.ListView1.ListItems.Count = Form11.MusicIndex Then
    Image1.Picture = LoadPicture(App.Path & "\mp3\msgstate1.gif")
    Timer1.Interval = 0
  End If
ElseIf .wmp.playState = 2 Then
  Image1.Picture = LoadPicture(App.Path & "\mp3\msgstate2.gif")
  Timer1.Interval = 0
End If
End With

End Sub

⌨️ 快捷键说明

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