Using Win32 functions in Visual FoxPro Image Gallery
Windows Multimedia
..msdn
AVIFileExit
AVIFileGetStream
AVIFileInfo
AVIFileInit
AVIFileOpen
AVIFileRelease
AVIFileWriteData
AVIStreamGetFrame
AVIStreamGetFrameClose
AVIStreamGetFrameOpen
AVIStreamInfo
AVIStreamLength
AVIStreamReadFormat
AVIStreamRelease
AVIStreamStart
AVIStreamTimeToSample
capCreateCaptureWindow
capGetDriverDescription
DrawDibClose
DrawDibDraw
DrawDibOpen
mciGetDeviceID
mciGetErrorString
mciSendCommand
mciSendString
midiOutClose
midiOutGetDevCaps
midiOutGetNumDevs
midiOutOpen
midiOutReset
midiOutShortMsg
mixerClose
mixerGetControlDetails
mixerGetDevCaps
mixerGetID
mixerGetLineControls
mixerGetLineInfo
mixerGetNumDevs
mixerOpen
mixerSetControlDetails
mmioAscend
mmioClose
mmioCreateChunk
mmioDescend
mmioFlush
mmioOpen
mmioRead
mmioSeek
mmioWrite
PlaySound
sndPlaySound
timeGetDevCaps
waveInAddBuffer
waveInClose
waveInGetDevCaps
waveInGetErrorText
waveInGetNumDevs
waveInGetPosition
waveInOpen
waveInPrepareHeader
waveInReset
waveInStart
waveInStop
waveInUnprepareHeader
waveOutClose
waveOutGetDevCaps
waveOutGetErrorText
waveOutGetNumDevs
waveOutGetPosition
waveOutGetVolume
waveOutOpen
waveOutPrepareHeader
waveOutReset
waveOutSetVolume
waveOutUnprepareHeader
waveOutWrite
Code examples:
Quering waveform-audio output devices
Quering waveform-audio output devices

User rating: 0/10 (0 votes)
Rate this code sample:
  • ~
More code examples    Listed functions    Add comment     W32 Constants      Translate this page Printer friendly version of this code sample
Versions:
click to open
Before you begin:
See also:
  • Enumerating devices installed on the local machine
  • #DEFINE MMSYSERR_NOERROR 0
    DO declare
    
    LOCAL nDevCount, nDevIndex
    
    nDevCount = waveOutGetNumDevs()
    
    IF nDevCount < 1
    * no waveform-audio output devices found
        RETURN
    ENDIF
    
    CREATE CURSOR csDevices (mid I, pid I, drvver I,;
        devname C(32), formats I, channels I)
    
    FOR nDevIndex=0 TO nDevCount-1
        DO QueryDevice WITH nDevIndex
    ENDFOR
    
    SELECT csDevices
    GO TOP
    BROWSE NORMAL NOWAIT
    * end of main
    
    PROCEDURE QueryDevice(nIndex)
    
    *|typedef struct { 
    *|    WORD      wMid;                 0:2
    *|    WORD      wPid;                 2:2
    *|    MMVERSION vDriverVersion;       4:4
    *|    TCHAR     szPname[MAXPNAMELEN]; 8:32
    *|    DWORD     dwFormats;           40:4
    *|    WORD      wChannels;           44:2
    *|    WORD      wReserved1;          46:2
    *|    DWORD     dwSupport;           48:4
    *|} WAVEOUTCAPS; total 52 bytes
    
    #DEFINE WAVEOUTCAPS_SIZE 52
    
        LOCAL cBuffer, nResult
        cBuffer = Repli(Chr(0), WAVEOUTCAPS_SIZE)
    
        nResult = waveOutGetDevCaps(nIndex,;
            @cBuffer, WAVEOUTCAPS_SIZE)
    
        IF nResult <> MMSYSERR_NOERROR
            ? "Error:", GetWaveError(nResult)
            RETURN
        ENDIF
    
        LOCAL mid, pid, drvver, devname,;
            formats, channels
    
        mid = buf2word(SUBSTR(cBuffer, 1,2))
        pid = buf2word(SUBSTR(cBuffer, 3,2))
    
        drvver = buf2dword(SUBSTR(cBuffer, 5,4))
    
        devname = SUBSTR(cBuffer, 9,32)
        devname = SUBSTR(m.devname, 1, AT(Chr(0),m.devname)-1)
    
        formats = buf2dword(SUBSTR(cBuffer, 41,4))
        channels = buf2word(SUBSTR(cBuffer, 45,2))
    
        INSERT INTO csDevices VALUES (m.mid, m.pid, m.drvver,;
            m.devname, m.formats, m.channels)
    
    FUNCTION GetWaveError(lnError)
        LOCAL lcBuf
        lcBuf = Repli(Chr(0), 250)
        = waveOutGetErrorText(lnError, @lcBuf, Len(lcBuf))
    RETURN STRTRAN(lcBuf, Chr(0),"")
    
    PROCEDURE declare
        DECLARE INTEGER waveOutGetNumDevs IN winmm
    
        DECLARE INTEGER waveOutGetDevCaps IN winmm;
            INTEGER uDeviceID, STRING @pwoc, LONG cbwoc
    
        DECLARE INTEGER waveOutGetErrorText IN winmm;
            INTEGER mmrError, STRING @pszText, LONG cchText
    
    FUNCTION buf2dword(lcBuffer)
    RETURN Asc(SUBSTR(lcBuffer, 1,1)) + ;
        BitLShift(Asc(SUBSTR(lcBuffer, 2,1)),  8) +;
        BitLShift(Asc(SUBSTR(lcBuffer, 3,1)), 16) +;
        BitLShift(Asc(SUBSTR(lcBuffer, 4,1)), 24)
    
    FUNCTION buf2word(lcBuffer)
    RETURN Asc(SUBSTR(lcBuffer, 1,1)) + ;
           Asc(SUBSTR(lcBuffer, 2,1)) * 256
    

    User rating: 0/10 (0 votes)
    Rate this code sample:
    • ~
    2324 bytes  
    Created: 2003-03-11 11:21:33  
    Modified: 2013-11-08 12:21:56  
    Visits in 7 days: 66  
    Listed functions:
    waveOutGetDevCaps
    waveOutGetErrorText
    waveOutGetNumDevs
    Printer friendly API declarations
    My comment:
    The device name the call returns (szPname[MAXPNAMELEN]) is cut off after 31st character.

    Using EnumAudioEndpoints method of IMMDeviceEnumerator interface is another option.
    Word Index links for this example:
    Translate this page:
      Spanish    Portuguese    German    French    Italian  
    FreeTranslation.com offers instant, free translations of text or web pages.
    User Contributed Notes:
    There are no notes on this subject.


    Copyright 2001-2017 News2News, Inc. Before reproducing or distributing any data from this site please ask for an approval from its owner. Unless otherwise specified, this page is for your personal and non-commercial use. The information on this page is presented AS IS, meaning that you may use it at your own risk. Microsoft Visual FoxPro and Windows are trade marks of Microsoft Corp. All other trademarks are the property of their respective owners. 

    Privacy policy
    Credits: PHP (4.4.9), an HTML-embedded scripting language, MySQL (5.6.38), the Open Source standard SQL database, AceHTML Freeware Version 4, freeware HTML Editor of choice.   Hosted by Korax Online Inc.
    Last Topics Visited (54.224.18.114)
    12 sec.Example: 'How to download a file from the FTP server using FtpGetFile'
    25 sec.Function: 'StretchDIBits'
    Function group: 'Bitmap'
    36 sec.Function: 'FindClose'
    Function group: 'File Management'
    48 sec.Banners
    1.02 min.Function: 'GdipCreateBitmapFromGraphics'
    Function group: 'GDI+ Bitmap'
    1.22 min.Function: 'CeSeekDatabase'
    Function group: 'Remote Application Programming (RAPI)'
    1.43 min.Function: 'sndPlaySound'
    Function group: 'Windows Multimedia'
    1.65 min.
    1.9 min.Function: 'mixerGetLineInfo'
    Function group: 'Windows Multimedia'
    2.1 min.Function: 'mixerClose'
    Function group: 'Windows Multimedia'
    Google
    Advertise here!