Using Win32 functions in Visual FoxPro Image Gallery
Code examples:
Custom GDI+ class
Splash Screen for the VFP application
Subclassing CommandButton control to create BackColor property
Obtaining names and positions for shortcuts located on the Windows Desktop
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)
Enumerating devices installed on the local machine
GDI+: Implementing image scrolling with inertia
Printing text with the Escape function
Displaying dimmed window behind VFP top-level form
Moving shortcut to a specified position on the Windows Desktop
System Image List Viewer
How to put a horizontal text scrolling on the form (a news line, marquee)
Vertical Label control
Storing content of the Clipboard to a bitmap file
How to play AVI file on the _screen
Custom FTP Class for Visual FoxPro application
Creating a console window for Visual FoxPro application
Monitoring clipboard content changes (VFP9)
Detecting changes in connections to removable drives (VFP9)
Mapping and disconnecting network drives
Passing data records between VFP applications via the Clipboard
How to detect if additional monitor is connected and active
Placing an arbitrary rectangular area of main VFP window on the Clipboard
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
  • Controlling master audio volume by sending WM_APPCOMMAND messages
  • WAV file recorder
  • How to play MIDI notes
      Members area. Log in to view this example.
      User name:
      Forgot your password?
      Sign up for
    the Membership

    User rating: 8/10 (1 votes)
    Rate this code sample:
    • ~
    6885 bytes  
    Created: 2007-02-16 18:22:01  
    Modified: 2016-02-25 09:23:01  
    Visits in 7 days: 225  
    Listed functions:
    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\Windows XP Shutdown.wav")

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

    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 offers instant, free translations of text or web pages.
    User Contributed Notes:
    There are no notes on this subject.

    Copyright 2001-2018 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.39), the Open Source standard SQL database, AceHTML Freeware Version 4, freeware HTML Editor of choice.   Hosted by Korax Online Inc.
    Last Topics Visited (
    27 sec.Function: 'CeRapiInvoke'
    Function group: 'Remote Application Programming (RAPI)'
    57 sec.Example: 'Displaying the associated icons and descriptions for files and folders'
    1.47 min.Examples
    2.07 min.Function: 'WNetGetProviderName'
    Function group: 'Windows Networking'
    2.67 min.Solutions
    3.25 min.Function: 'GetCharABCWidths'
    Function group: 'Font and Text'
    3.85 min.Function: 'CeGlobalMemoryStatus'
    Function group: 'Remote Application Programming (RAPI)'
    4.48 min.
    7.68 min.Function: 'CreateEvent'
    Function group: 'Synchronization'
    19 hrs.Function: 'CreateCompatibleDC'
    Advertise here!