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
Custom GDI+ class
Converting Unicode data from the Clipboard to a character string using a given code page
Capturing keyboard activity of another application with the Raw Input API (VFP9)
Enumerating data formats currently available on the clipboard
Winsock: sending email messages (SMTP, port 25)
Detecting changes in connections to removable drives (VFP9)
Custom FTP Class for Visual FoxPro application
How to download a file from the FTP server using FtpGetFile
Splash Screen for the VFP application
Mapping and disconnecting network drives
Custom HttpRequest class (WinINet)
How to activate Windows Calculator
How to convert a bitmap file to monochrome format (1 bpp)
Custom HttpRequest class (WinHTTP)
Enumerating raw input devices attached to the system (keyboard, mouse, human interface device)
Establishing connection using the SQLDriverConnect
GDI+: copying to the Clipboard (a) image of active FoxPro window/form, (b) image file
Using Font and Text functions
Displaying bitmap using the AlphaBlend function
Using WM_COPYDATA for interprocess communication (VFP9)
Using EnumPrinters function to enumerate locally installed printers
Extensible Storage Engine class library
Playing WAV sounds simultaneously

User rating: 8/10 (1 votes)
Rate this code sample:
  • ~
More code examples    Listed functions    Add comment     W32 Constants      Translate this page Printer friendly version of this code sample
Before you begin:
This code is written in response to a question posted on UT: Ride two WAVs at once?

The sndPlaySound is not suitable for this. To play multiple sounds simultaneously, the waveOut* functions must be used.

See also:

  • WAV file player
  • WAV file recorder
  • How to play MIDI notes
  •  
      Members area. Log in to view this example.
     
      User name:
      Password:
     
     
      Forgot your password?
     
      Sign up for
    the Membership
     
      Buy this example for $10.00
    Instant email delivery.

    Read more...
     


    User rating: 8/10 (1 votes)
    Rate this code sample:
    • ~
    6885 bytes  
    Created: 2007-02-16 18:22:01  
    Modified: 2012-09-19 14:17:50  
    Visits in 7 days: 126  
    Listed functions:
    GlobalAlloc
    GlobalFree
    mmioAscend
    mmioClose
    mmioDescend
    mmioOpen
    mmioRead
    waveOutClose
    waveOutOpen
    waveOutPrepareHeader
    waveOutReset
    waveOutUnprepareHeader
    waveOutWrite
    Printer friendly API declarations
    My comment:
    The code above contains two classes. The WavPlayer class wraps API declarations and acts as a factory for creating instances of the WavSound class.

    On Init, an instance of WavSound opens specified WAV file, loads it in memory, and makes ready to be played.

    Here is a code for testing WavPlayer and WavSound classes.
    PUBLIC wp As WavPlayer
    wp = CREATEOBJECT("WavPlayer")

    wp.LoadWavSound("C:\WINDOWS\Media\Windows XP Logoff Sound.wav")
    wp.LoadWavSound("C:\WINDOWS\Media\Windows XP Startup.wav")
    wp.LoadWavSound("C:\WINDOWS\Media\Windows XP Logon Sound.wav")
    wp.LoadWavSound("C:\WINDOWS\Media\tada.wav")
    wp.LoadWavSound("C:\WINDOWS\Media\notify.wav")
    wp.LoadWavSound("C:\WINDOWS\Media\chord.wav")
    wp.LoadWavSound("C:\WINDOWS\Media\Windows XP Shutdown.wav")

    FOR nTimes=1 TO 1
            FOR nIndex=1 TO wp.WavSounds.Count
                    wp.PlayWavSound(m.nIndex)
                    = INKEY(0.1)
            NEXT
    NEXT

    Note that wp variable must not be released while the sounds are being played. For that reason it is declared PUBLIC.

    API function mmioRead is declared twice with two different interfaces. In VFP versions 3 to 7, these declarations must be moved to LoadWaveFile method of WavSound class and placed each before corresponding call.
    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 (54.242.188.217)
    2.31 hrs.Example: 'GDI+: how to make VFP controls visually shake and shudder'
     Example: 'How to get Special Folders paths'
    3.7 hrs.Example: 'Using an Event Object. Part B: running an application responding to events'
     Function: 'UuidCreate'
    5.79 hrs.Example: 'Using the Semaphore object to allow only one instance of VFP application running'
     Function: 'GetSystemDirectory'
    13.66 hrs.Example: 'Semi-transparent Form'
    13.67 hrs.Function: 'InternalGetWindowText'
    14.89 hrs.Example: 'Displaying system dialog that selects a folder'
     Function: 'WaitForSingleObject'
    Google
    Advertise here!