谁可以帮我
Private Sub Form_Click()
shellid = Shell( "C:\Program Files\Windows Media Player\wmplayer.exe G:\刻录\H盘\阿牛\任贤齐 光良 阿牛_浪花一朵朵.mp3 ", vbNormalFocus)
End Sub
'音乐文件含有空格为什么不能播放.有什么解决方案吗
[解决办法]
Option Explicit
Private Declare Function GetShortPathName Lib "kernel32" Alias "GetShortPathNameA" (ByVal lpszLongPath As String, ByVal lpszShortPath As String, ByVal cchBuffer As Long) As Long
Dim aa$, bb$
Private Sub Command1_Click()
aa = GetShortName(Environ("programfiles") & "\Windows Media Player\mplayer2.exe")
bb = GetShortName("G:\刻录\H盘\阿牛\任贤齐 光良 阿牛_浪花一朵朵.mp3")
Call Shell(aa & " " & bb, vbNormalFocus)
End Sub
Public Function GetShortName(ByVal sLongFileName As String) As String
Dim lRetVal&, sShortPathName$
sShortPathName = Space(255)
Call GetShortPathName(sLongFileName, sShortPathName, 255)
If InStr(sShortPathName, Chr(0)) > 0 Then
GetShortName = Trim(Mid(sShortPathName, 1, InStr(sShortPathName, Chr(0)) - 1))
Else
GetShortName = Trim(sLongFileName)
End If
End Function