VERSION 5.00
Begin VB.Form Form1
Caption = "播放多媒体文件"
ClientHeight = 3285
ClientLeft = 60
ClientTop = 345
ClientWidth = 4890
LinkTopic = "Form1"
ScaleHeight = 3285
ScaleWidth = 4890
StartUpPosition = 3 '窗口缺省
Begin VB.CommandButton Command1
Caption = "播放"
Height = 495
Left = 240
TabIndex = 5
Top = 2640
Width = 1335
End
Begin VB.CommandButton Command2
Caption = "停止播放"
Height = 495
Left = 2160
TabIndex = 4
Top = 2640
Width = 1455
End
Begin VB.FileListBox File1
Height = 1890
Left = 2160
Pattern = "*.wav;*.mid;*.avi"
TabIndex = 2
Top = 480
Width = 2535
End
Begin VB.DirListBox Dir1
Height = 1560
Left = 240
TabIndex = 1
Top = 960
Width = 1815
End
Begin VB.DriveListBox Drive1
Height = 300
Left = 240
TabIndex = 0
Top = 480
Width = 1815
End
Begin VB.Label Label1
AutoSize = -1 'True
Caption = "请选择.wav.mid.avi文件"
Height = 180
Left = 120
TabIndex = 3
Top = 120
Width = 2412
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
Private Declare Function GetShortPathName Lib "kernel32" Alias "GetShortPathNameA" (ByVal lpszLongPath As String, ByVal lpszShortPath As String, ByVal cchBuffer As Long) As Long
Private Sub Command1_Click()
Dim PathName As String, S As String, ShortPathName As String
PathName = File1.Path
If Right(PathName, 1) <> "\" Then PathName = PathName & "\"
PathName = PathName & File1.FileName