参考
'Author: Gordon F. MacLeod
' How to play a CD Audio disc via API
' Declare the following API
Declare Function mciSendString& Lib "MMSYSTEM" (ByVal lpstrCommand$,
ByVal lpstrReturnStr As Any, ByVal wReturnLen%, ByVal hCallBack%)'Add the code below to appropriate routinesSub cmdPlay_Click ()
Dim lRet As Long
Dim nCurrentTrack As Integer'Open the device
lRet = mciSendString("open cdaudio alias cd wait", 0&, 0, 0)'Set the time format to Tracks (default is milliseconds)
lRet = mciSendString("set cd time format tmsf", 0&, 0, 0)'Then to play from the beginning
lRet = mciSendString("play cd", 0&, 0, 0)'Or to play from a specific track, say track 4
nCurrentTrack = 4
lRet = mciSendString("play cd from" & Str(nCurrentTrack), 0&, 0, 0)End Sub
' Remember to Close the device when ending playbackSub cmdStop_Click ()
Dim lRet As Long'Stop the playback
lRet = mciSendString("stop cd wait", 0&, 0, 0)DoEvents 'Let Windows process the event'Close the device
lRet = mciSendString("close cd", 0&, 0, 0)End Sub
'Author: Gordon F. MacLeod
' How to play a CD Audio disc via API
' Declare the following API
Declare Function mciSendString& Lib "MMSYSTEM" (ByVal lpstrCommand$,
ByVal lpstrReturnStr As Any, ByVal wReturnLen%, ByVal hCallBack%)'Add the code below to appropriate routinesSub cmdPlay_Click ()
Dim lRet As Long
Dim nCurrentTrack As Integer'Open the device
lRet = mciSendString("open cdaudio alias cd wait", 0&, 0, 0)'Set the time format to Tracks (default is milliseconds)
lRet = mciSendString("set cd time format tmsf", 0&, 0, 0)'Then to play from the beginning
lRet = mciSendString("play cd", 0&, 0, 0)'Or to play from a specific track, say track 4
nCurrentTrack = 4
lRet = mciSendString("play cd from" & Str(nCurrentTrack), 0&, 0, 0)End Sub
' Remember to Close the device when ending playbackSub cmdStop_Click ()
Dim lRet As Long'Stop the playback
lRet = mciSendString("stop cd wait", 0&, 0, 0)DoEvents 'Let Windows process the event'Close the device
lRet = mciSendString("close cd", 0&, 0, 0)End Sub
#VBIDEUtils#************************************************************
' * Programmer Name : Waty Thierry
' * Web Site : www.geocities.com/ResearchTriangle/6311/
' * E-Mail : [email protected]
' * Date : 29/10/98
' * Time : 14:31
' * Module Name : Browse_Folder
' * Module Filename : Browse_Folder.bas
' **********************************************************************
' * Comments : Recording a CD to a Wave file
' * This Function uses the multimedia control interface (MCI) To control the CD drive.
' **********************************************************************Public Sub RecordWave(TrackNum As Integer, Filename As String)
' Tracknum: track to record
' Filename: file to save wave as
On Local Error Resume Next
Dim i As Long, RS As String, cb As Long, t#
RS = Space$(128)
i = mciSendString("stop cdaudio", RS, 128, cb)
i = mciSendString("close cdaudio", RS, 128, cb)
Kill Filename
RS = Space$(128)
i = mciSendString("status cdaudio position track " & TrackNum, RS, 128, cb)
i = mciSendString("open cdaudio", RS, 128, cb)
i = mciSendString("set cdaudio time format milliseconds", RS, 128, cb)
i = mciSendString("play cdaudio", RS, 128, cb)
i = mciSendString("open new type waveaudio alias capture", RS, 128, cb)
i = mciSendString("record capture", RS, 128, cb)
t# = Timer + 1: Do Until Timer > t#: DoEvents: Loop
i = mciSendString("save capture " & Filename, RS, 128, cb)
i = mciSendString("stop cdaudio", RS, 128, cb)
i = mciSendString("close cdaudio", RS, 128, cb)
End Sub'The method Is quite easy:
'
'1) Stop everything In the CD drive
'2) Start playing track
'3) Record a New wave With the information from the CD (note: it also records MIDI And microphone sounds: In fact anything coming out of the speakers)
'4) Save the wave file
'5) Stop the CD again
能发给我一份么?我的E-mail: [email protected]谢谢各位了!谢谢! 我找到的OCX,大家就不用找了。如ACD。
希望大家能帮帮我,分不够,我会另外给的。