Using Win32 functions in Visual FoxPro Image Gallery
Code examples:
Enumerating devices installed on the local machine
Retrieving the name of the network resource associated with a local device
Drawing standard Windows icons
How to initiate System shutdown
Initiating Inet connection using a modem
Switching between keyboard layouts
Testing if a connection to an Url can be established
Using Font and Text functions
Using Month Calendar Control (VFP9, Comctl32.dll)
GDI+: Scrolling through large image using the mouse
How to enumerate sessions and processes on a specified terminal server
How to play AVI file on the _screen
Vertical Label control
GDI+: saving image of FoxPro form to graphics file (BMP, GIF, JPG, PNG, TIF)
GDI+: Storing content of the Clipboard to a bitmap file
Reading metrics for the currently selected font
Animating a transition of the VFP form (a wire-frame rectangle)
Current keyboard type
Extensible Storage Engine class library
Shortcut Menu Class
Adding supplementary data to AVI files
How to release and renew a lease on an IP address previously obtained through Dynamic Host Configuration Protocol (DHCP)
Class library providing access to the System Registry
Drawing cursors for the classes defined by the system (preregistered): BUTTON, EDIT, LISTBOX etc.
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: 127  
    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 (50.17.109.248)
    3.09 hrs.Example: 'Storing the environment strings in cursor'
    7.16 hrs.Example: 'Obtaining some properties for the Windows desktop using the GetWindowPlacement function'
    7.17 hrs.Function: 'GetKeyNameText'
    Function group: 'Keyboard Input'
    7.31 hrs.Function: 'WNetGetConnection'
     Function: 'SetClipboardViewer'
    8.11 hrs.Example: 'An alternative way of setting Form.Closable to False'
    13.4 hrs.Function: 'GetDoubleClickTime'
    Function group: 'Mouse Input'
    Google
    Advertise here!