home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #20 / NN_1992_20.iso / spool / comp / os / mswindo / programm / misc / 1750 < prev    next >
Encoding:
Text File  |  1992-09-09  |  1.4 KB  |  48 lines

  1. Newsgroups: comp.os.ms-windows.programmer.misc
  2. Path: sparky!uunet!microsoft!hexnut!joero
  3. From: joero@microsoft.com (Joe Robison)
  4. Subject: Re: A Visual Basic question
  5. Message-ID: <1992Sep09.062746.9127@microsoft.com>
  6. Date: 09 Sep 92 06:27:46 GMT
  7. Organization: Microsoft Corp.
  8. References: <1992Sep8.154902.1@vx24.cc.monash.edu.au> 
  9. Lines: 37
  10.  
  11. In article <1992Sep8.154902.1@vx24.cc.monash.edu.au> edd701ssft@vx24.cc.monash.edu.au wrote:
  12. > Hi,
  13. > I was wondering if it is at all possible to incorporate a sound playing
  14. > feature into my Visual Basic program (i.e. press a button that will 
  15. > play a prerecorded digitised sound).
  16. > If you have knowledge of such a technique I would greatly appreciate
  17. > you sharing it with me.
  18. > Thanks.
  19. > Please email your replies to :
  20. > edd701ssft@vx24.cc.monash.edu.au
  21. > Vincent,
  22. > Monash University.
  23.  
  24. Piece of cake, assuming you have Windows 3.1 and a sound card (or
  25. at least the PC speaker driver, though your results with that may
  26. be a little disappointing).
  27.  
  28. In your global module (or the declarations section of any form
  29. or module):
  30. Declare Function sndPlaySound Lib "MMSystem" (ByVal lpsound As String, ByVal flag As Integer) As Integer
  31.  
  32. In your code:
  33. sndPlaySound "chimes.wav", 1
  34.  
  35. That's it. If you don't provide a path in the string, Windows looks
  36. for it in your Windows directory. The second argument controls whether 
  37. the sound is played synchronously or asynchronously.
  38.