📄 音乐播放器.frm
字号:
VERSION 5.00
Object = "{6BF52A50-394A-11D3-B153-00C04F79FAA6}#1.0#0"; "wmp.dll"
Object = "{F9043C88-F6F2-101A-A3C9-08002B2F49FB}#1.2#0"; "COMDLG32.OCX"
Begin VB.Form Form1
Caption = "依梦恋制作QQ:398774428"
ClientHeight = 5730
ClientLeft = 165
ClientTop = 555
ClientWidth = 9015
Icon = "音乐播放器.frx":0000
LinkTopic = "Form1"
ScaleHeight = 5730
ScaleWidth = 9015
StartUpPosition = 3 '窗口缺省
Begin VB.CommandButton Command3
Caption = "最小化到托盘"
Height = 375
Left = 7440
TabIndex = 6
Top = 360
Width = 1575
End
Begin VB.Timer Timer3
Interval = 300
Left = 4800
Top = 4920
End
Begin VB.Timer Timer2
Interval = 100
Left = 4320
Top = 4920
End
Begin VB.Timer Timer1
Enabled = 0 'False
Interval = 1000
Left = 3840
Top = 4920
End
Begin VB.CommandButton Command2
Caption = "删除歌曲"
Height = 375
Left = 7440
TabIndex = 4
Top = 0
Width = 1575
End
Begin VB.CommandButton Command1
Caption = "添加歌曲"
Height = 375
Left = 5760
TabIndex = 3
Top = 0
Width = 1455
End
Begin VB.ListBox List1
Height = 4560
Left = 5880
TabIndex = 1
Top = 720
Width = 3015
End
Begin MSComDlg.CommonDialog CommonDialog1
Left = 3360
Top = 4800
_ExtentX = 847
_ExtentY = 847
_Version = 393216
End
Begin VB.Label Label2
Height = 495
Left = 0
TabIndex = 5
Top = 5280
Width = 8895
End
Begin VB.Label Label1
Caption = "播放列表"
BeginProperty Font
Name = "宋体"
Size = 15.75
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
ForeColor = &H000000FF&
Height = 375
Left = 5880
TabIndex = 2
Top = 360
Width = 1335
End
Begin WMPLibCtl.WindowsMediaPlayer WindowsMediaPlayer1
Height = 5415
Left = 0
TabIndex = 0
Top = -120
Width = 5775
URL = ""
rate = 1
balance = 0
currentPosition = 0
defaultFrame = ""
playCount = 1
autoStart = -1 'True
currentMarker = 0
invokeURLs = -1 'True
baseURL = ""
volume = 50
mute = 0 'False
uiMode = "full"
stretchToFit = 0 'False
windowlessVideo = 0 'False
enabled = -1 'True
enableContextMenu= -1 'True
fullScreen = 0 'False
SAMIStyle = ""
SAMILang = ""
SAMIFilename = ""
captioningID = ""
enableErrorDialogs= 0 'False
_cx = 10186
_cy = 9551
End
Begin VB.Menu right
Caption = "右键"
Visible = 0 'False
Begin VB.Menu addmusic
Caption = "添加歌曲"
End
Begin VB.Menu delmusic
Caption = "删除歌曲"
End
Begin VB.Menu close
Caption = "关闭"
End
Begin VB.Menu my
Caption = "关于作者"
End
End
End
Attribute VB_Name = "Form1"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Dim ab As String, nowtime As String, i As Integer
Private Declare Function Shell_NotifyIcon Lib "shell32.dll" (ByVal dwMessage As Long, lpData As NOTIFYICONDATA) As Long
Const NIM_ADD = &H0
Const NIM_DELETE = &H2
Const NIF_ICON = &H2
Const NIF_MESSAGE = &H1
Const NIF_TIP = &H4
Const WM_MOUSEMOVE = &H200
Const WM_LBUTTONDBLCLK = &H203
Private Type NOTIFYICONDATA
cbSize As Long
hwnd As Long
uId As Long
uFlags As Long
uCallBackMessage As Long
hIcon As Long
szTip As String * 64
End Type
Dim tray As NOTIFYICONDATA
Private Sub addmusic_Click()
Call Command1_Click
End Sub
Private Sub close_Click()
End
End Sub
Private Sub Command3_Click()
tray.cbSize = Len(tray)
tray.uId = vbNull
tray.hwnd = Me.hwnd
tray.uFlags = NIF_TIP Or NIF_MESSAGE Or NIF_ICON
tray.uCallBackMessage = WM_MOUSEMOVE
tray.hIcon = Me.Icon
tray.szTip = "双击还原" & vbNullChar
Shell_NotifyIcon NIM_ADD, tray
Me.Hide
End Sub
Private Sub delmusic_Click()
Call Command2_Click
End Sub
Private Sub Form_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
Dim msg As Long
msg = X / 15
If msg = WM_LBUTTONDBLCLK Then
Me.Show
Shell_NotifyIcon NIM_DELETE, tray
End If
End Sub
Private Sub Command1_Click()
Dim song As String
With CommonDialog1
.FontName = ""
.Filter = "mp3音频(*.mp3)|*.mp3|wma音频(*.wma)|*.wma|avi视频(*.avi)|*.avi|所有文件(*.*)|*.*"
.ShowOpen
song = .FileName
End With
If song = "" Then Exit Sub
a = ""
For i = Len(song) To 1 Step -1
B = Mid(song, i, 1)
If B = "" Then
List1.AddItem a
a = ""
ElseIf B = "\" Then
List1.AddItem a
ab = Left(song, i)
Exit Sub
Else
a = B & a
End If
Next i
End Sub
Private Sub Command2_Click()
If List1.ListIndex = -1 Then
MsgBox "请选择你要删除的选项", 16, "依梦恋提示你"
Else
List1.RemoveItem List1.ListIndex
End If
End Sub
Private Sub Form_Load()
i = 10
End Sub
Private Sub Form_Resize()
Dim H, i As Integer
On Error Resume Next
Resize_ALL Me 'Me是窗体名,Form1,Form2等等都可以
End Sub
Private Sub List1_DblClick()
Timer1.Enabled = True
WindowsMediaPlayer1.URL = ab & List1.Text
End Sub
Private Sub List1_MouseUp(Button As Integer, Shift As Integer, X As Single, Y As Single)
If Button = 2 Then
PopupMenu Form1.right
End If
End Sub
Private Sub my_Click()
Shell "explorer http://user.qzone.qq.com/398774428", vbNormalFocus
End Sub
Private Sub Timer1_Timer()
Label2.Caption = "本软件by依梦恋制作QQ:398774428,正在播放:" + ab & List1.Text & Chr(13) & "现在时间是:" & Date & " " & Time
End Sub
Private Sub Timer2_Timer()
i = i - 1
If i = 1 Or i = 3 Or i = 5 Or i = 7 Or i = 9 Then
Label1.ForeColor = vbRed
Else
Label1.ForeColor = vbGreen
End If
If i = 0 Then
i = 10
End If
End Sub
Private Sub Timer3_Timer()
Dim R As Integer, G As Integer, B As Integer
Randomize
R = Int(256 * Rnd)
G = Int(256 * Rnd)
B = Int(256 * Rnd)
Label2.ForeColor = RGB(R, G, B)
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -