看来你是想要完整的代码: '第一个API用来存储短文件名,因为mcisendstring函数不能识别长文件名 declare Function GETShortPathName Lib"Kernel32" Alias "GetAhortPathNameA"( _ byval lpsLongPath as string,byval lpsShortPath as string,byval cchBuffer _ as long) as long declare Function mcisendstring Lib "winmm.dll" Aleas "mcisendstringA"(byval _ lpstrCommand as string,byval lpstrRetunString as string _ byval uReturnLength as long,byval hWndCallback as long) as _ long public sub Player() dim Lname as string dim Sname as string*256 Lname=你要播放的文件名 call GetShortPathName(Lname,Sname,256) call mcisendstring("play " & Sname & "From 0 to 5000",vbnullstring,0,0)'只播放0-5的5秒 '你想从那里开始到哪里结束都可以,只要把 “From……to ……”的时间改一下(单位为:毫秒) end sub private sub command1_click() call Player end sub
mcisendstring "stop " & 文件名,vbnullstring,0,0 停止播放
"play "是命令后面的空格不能少了,文件名里不要带空格,
更详细的请给我短信,因为我不常上网
'第一个API用来存储短文件名,因为mcisendstring函数不能识别长文件名
declare Function GETShortPathName Lib"Kernel32" Alias "GetAhortPathNameA"( _
byval lpsLongPath as string,byval lpsShortPath as string,byval cchBuffer _
as long) as long declare Function mcisendstring Lib "winmm.dll" Aleas "mcisendstringA"(byval _
lpstrCommand as string,byval lpstrRetunString as string _
byval uReturnLength as long,byval hWndCallback as long) as _
long
public sub Player()
dim Lname as string
dim Sname as string*256
Lname=你要播放的文件名
call GetShortPathName(Lname,Sname,256)
call mcisendstring("play " & Sname & "From 0 to 5000",vbnullstring,0,0)'只播放0-5的5秒
'你想从那里开始到哪里结束都可以,只要把 “From……to ……”的时间改一下(单位为:毫秒)
end sub private sub command1_click()
call Player
end sub