INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Jobs

API Functions

How to Play a WAV file Sound by wgcs
Posted: 1 Dec 03 (Edited 26 Jun 06)

You can take the goofy way:

CODE

SET BELL TO "c:\source\Sounds\blip.wav"
? chr(7)
SET BELL TO

or you can take the windows API route:

CODE

PlaySound('c:\source\Sounds\blip.wav')


PROCEDURE PlaySound( tcWavFile, tnFlags )
  * play synchronously (default) */
  #define SND_SYNC            0x0000  
  * play asynchronously */
  #define SND_ASYNC           0x0001  
  * silence (!default) if sound not found */
  #define SND_NODEFAULT       0x0002  
  * pszSound points to a memory file */
  #define SND_MEMORY          0x0004  
  * loop the sound until next sndPlaySound */
  #define SND_LOOP            0x0008  
  * don't stop any currently playing sound */
  #define SND_NOSTOP          0x0010  
  
  * don't wait if the driver is busy */
  #define SND_NOWAIT          0x00002000
  * name is a registry alias */
  #define SND_ALIAS           0x00010000
  * alias is a predefined ID */
  #define SND_ALIAS_ID          0x00110000
  * name is file name */
  #define SND_FILENAME        0x00020000
  * name is resource name or atom */
  #define SND_RESOURCE        0x00040004
  *#if(WINVER >= 0x0400)
  * purge non-static events for task */
  #define SND_PURGE           0x0040  
  * look for application specific association */
  #define SND_APPLICATION     0x0080  
  *#endif /* WINVER >= 0x0400 */

  DECLARE INTEGER PlaySound IN WinMM.dll AS PS_API ;
    STRING @ pszSound, INTEGER HMODULE_hmod, LONG DWORD_fdwSound  
  LOCAL lnFlags
  lnFlags = iif( vartype(tnFlags)='N', tnFlags, SND_ASYNC+SND_FILENAME )
  PS_API(tcWavFile,0,lnFlags)
ENDPROC

Back to Microsoft: Visual FoxPro FAQ Index
Back to Microsoft: Visual FoxPro Forum

My Archive

Resources

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close