Using Win32 functions in Visual FoxPro Image Gallery
Code examples:
How to change display settings: screen resolution, screen refresh rate
Adding and deleting Scheduled Tasks using NetScheduleJob API functions
Capturing keyboard activity of another application with the Raw Input API (VFP9)
Custom GDI+ class
Converting Unicode data from the Clipboard to a character string using a given code page
Custom FTP Class for Visual FoxPro application
Custom HttpRequest class (WinINet)
Splash Screen for the VFP application
Displaying bitmap using the AlphaBlend function
Establishing connection using the SQLDriverConnect
Displaying animated images on FoxPro form with BitBlt and StretchBlt functions
How to put a vertical text scrolling on the form (a movie cast)
How to make a VFP form fading out when released (GDI+ version)
How to make a VFP form fading out when released (GDI version)
Using FlashWindowEx to flash the taskbar button of the VFP application
Winsock: sending email messages (SMTP, port 25)
How to create non-blocking Winsock server
Using WM_COPYDATA for interprocess communication (VFP9)
Creating a mailslot
Peer-to-peer LAN messenger built with Mailslot API functions
Detecting changes in connections to removable drives (VFP9)
How to print a bitmap file
Class for sound recording
GDI+: copying to the Clipboard (a) image of active FoxPro window/form, (b) image file
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: 87  
    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 (184.73.74.47)
    7 sec.Example: 'How to print a bitmap file'
    33.2 min.Example: 'Open and close a Simple MAPI Session'
    6.42 hrs.Example: 'Printing Image File, programmatically set print page orientation to landscape'
    12.96 hrs.Function: 'WSARecv'
    Function group: 'Windows Sockets 2 (Winsock)'
     Function: 'listen'
    Google
    Advertise here!