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: 2010-12-20 10:59:43  
    Visits in 7 days: 100  
    Listed functions:
    waveOutGetDevCaps
    waveOutGetErrorText
    waveOutGetNumDevs
    Printer friendly API declarations
    My comment:
    The device name (szPname[MAXPNAMELEN]) is limited to 31 characters, and thus gets truncated quite often.
    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-2013 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.1.55-log), the Open Source standard SQL database, AceHTML Freeware Version 4, freeware HTML Editor of choice.   Hosted by Korax Online Inc.
    Last Topics Visited (23.22.76.170)
    4.51 hrs.Example: 'Saving available locale records into a cursor'
     Example: 'Enumerating network resources'
    5.44 hrs.Function: 'GetAncestor'
    Function group: 'Window'
     Function: 'WTSEnumerateServers'
    6.01 hrs.Example: 'Accessing Adobe Reader 7.0 main menu from VFP application'
    8.55 hrs.Example: 'How to make a VFP form fading out when released (GDI+ version)'
    16.99 hrs.Function: 'UnregisterHotKey'
    Function group: 'Keyboard Input'
     Example: 'Running a regular FoxPro form while main VFP window is minimized'
    19.85 hrs.Example: 'Writing entries to custom Event Log'
     Function: 'WSAWaitForMultipleEvents'
    Function group: 'Windows Sockets 2 (Winsock)'
    Google
    Advertise here!