API CD Player
Posted
by Evan Silich
on January 30th, 2004
Some API calls it uses are:
Declare Function mciGetErrorString Lib "winmm.dll" Alias _
"mciGetErrorStringA" _
(byval dwError as Long, byval lpstrBuffer as string, _
byval uLength as Long) as Long
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
'
public hmem as Long
'
public Const SND_ASYNC = &H1
public Const SND_NODEFAULT = &H2
public Const SND_PURGE = &H40
public Const SND_FILENAME = &H20000
'
public Const MMSYSERR_NOERROR = 0
public Const MAXPNAMELEN = 32
public Const MIXER_LONG_NAME_CHARS = 64
public Const MIXER_SHORT_NAME_CHARS = 16
public Const MIXER_GETLINEINFOF_COMPONENTTYPE = &H3&
public Const MIXER_GETCONTROLDETAILSF_VALUE = &H0&
public Const MIXER_SETCONTROLDETAILSF_VALUE = &H0&
public Const MIXER_GETLINECONTROLSF_ONEBYTYPE = &H2&
public Const MIXERLINE_COMPONENTTYPE_DST_FIRST = &H0&
public Const MIXERLINE_COMPONENTTYPE_SRC_FIRST = &H1000&
public Const MIXERLINE_COMPONENTTYPE_DST_SPEAKERS = _
(MIXERLINE_COMPONENTTYPE_DST_FIRST + 4)
public Const MIXERLINE_COMPONENTTYPE_SRC_MICROPHONE = _
(MIXERLINE_COMPONENTTYPE_SRC_FIRST + 3)
public Const MIXERLINE_COMPONENTTYPE_SRC_LINE = _
(MIXERLINE_COMPONENTTYPE_SRC_FIRST + 2)
public Const MIXERCONTROL_CT_CLASS_FADER = &H50000000
public Const MIXERCONTROL_CT_UNITS_UNSIGNED = &H30000
public Const MIXERCONTROL_CONTROLTYPE_FADER = _
(MIXERCONTROL_CT_CLASS_FADER Or _
MIXERCONTROL_CT_UNITS_UNSIGNED)
'
public Const MIXERCONTROL_CONTROLTYPE_VOLUME = _
(MIXERCONTROL_CONTROLTYPE_FADER + 1)
'
public Type MIXERCONTROLDETAILS
cbStruct as Long
dwControlID as Long
cChannels as Long
item as Long
cbDetails as Long
paDetails as Long
End Type
'
public Type MIXERCONTROLDETAILS_UNSIGNED
dwValue as Long
End Type
'
public Type MIXERCONTROL
'
public Type MIXERLINE
'
'Allocates the specified number of bytes from the heap.
'
Declare Function GlobalAlloc Lib "kernel32" (byval _
wFlags as Long, _
byval dwBytes as Long) as Long
'
'Locks a global memory object and returns a pointer to the
' first byte of the object's memory block. The memory block
' associated with a locked object cannot be moved or discarded.
'
Declare Function GlobalLock Lib "kernel32" (byval _
hmem as Long) as Long
'
'Frees the specified global memory object and invalidates
'its handle.
'
Declare Function GlobalFree Lib "kernel32" (byval hmem as Long) _
as Long
'
Declare Sub CopyPtrFromStruct Lib "kernel32" Alias _
"RtlMoveMemory" _
(byval ptr as Long, struct as Any, byval cb as Long)
'
Declare Sub CopyStructFromPtr Lib "kernel32" Alias "RtlMoveMemory" _
(struct as Any, byval ptr as Long, byval cb as Long)
'
'Opens a specified mixer device and ensures that the
'device will not be removed until the application
'closes the handle.
'
Declare Function mixerOpen Lib "winmm.dll" _
(phmx as Long, byval uMxId as Long, byval dwCallback as Long, _
byval dwInstance as Long, byval fdwOpen as Long) as Long
'
'Sets properties of a single control associated with an
'audio line.
'
Declare Function mixerSetControlDetails Lib "winmm.dll" _
(byval hmxobj as Long, pmxcd as MIXERCONTROLDETAILS, _
byval fdwDetails as Long) as Long
'
'Retrieves information about a specific line of a mixer device.
'
Declare Function mixerGetLineInfo Lib "winmm.dll" _
Alias "mixerGetLineInfoA" (byval hmxobj as Long, _
pmxl as MIXERLINE, byval fdwInfo as Long) as Long
'
'Retrieves one or more controls associated with an audio line.
'
Declare Function mixerGetLineControls Lib "winmm.dll" _
Alias "mixerGetLineControlsA" (byval hmxobj as Long, _
pmxlc as MIXERLINECONTROLS, byval fdwControls as Long) _
as Long
'
public Function fGetVolumeControl(byval hmixer as Long, _
byval componentType as Long, byval ctrlType _
as Long, _
byref mxc as MIXERCONTROL) as Boolean
'

Comments
Hello
Posted by mourya09 on 05/16/2006 12:27amYour pgm is very nice
ReplyHow to select which CDROM
Posted by Legacy on 01/22/2004 12:00amOriginally posted by: robbage
So how do you select which CDOM drive to control? This program defaults to the wrong drive.
Replyhow to record
Posted by Legacy on 01/07/2004 12:00amOriginally posted by: Gultekin
ReplyVolume Control?
Posted by Legacy on 12/05/2003 12:00amOriginally posted by: B1GR3D
Hey ive been searching for a way to change the volume for like 3 months now lol and previously found out im going to need this API to do it.
I was wondering if you had the time could you send me the API for just changing the volume or make an example program itd be greatly appreciated and an example program might be a gd idea for others like me to also learn how to use it :)
Replyhttp://www.codeguru.com/vb/articles/2165.shtml
Posted by Legacy on 09/02/2003 12:00amOriginally posted by: Loc Huynh Gia
I need the code very much but I can't download it from the given page
Replyplease
Posted by Legacy on 08/18/2003 12:00amOriginally posted by: nimbargi
please send greate cd player source code for final year project.
ReplyWell That Is Amazing
Posted by Legacy on 07/18/2003 12:00amOriginally posted by: ZISHAN
Replyyou can download as bellow
Posted by Legacy on 06/21/2003 12:00amOriginally posted by: sanggy shin
http://www.codeguru.com/vb/articles/2165_Cd_Player.zip
ReplyI want to write data to CD Writer using vc++
Posted by Legacy on 05/07/2003 12:00amOriginally posted by: Manoj
I have a VC++ program which contains a file.I want to write that file to my CD Writer(can be of any type).
ReplyPls help me if U can........
requesting for file to download
Posted by Legacy on 05/02/2003 12:00amOriginally posted by: srikanth
ReplyLoading, Please Wait ...