home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: comp.os.ms-windows.programmer.misc
- Path: sparky!uunet!microsoft!hexnut!joero
- From: joero@microsoft.com (Joe Robison)
- Subject: Re: A Visual Basic question
- Message-ID: <1992Sep09.062746.9127@microsoft.com>
- Date: 09 Sep 92 06:27:46 GMT
- Organization: Microsoft Corp.
- References: <1992Sep8.154902.1@vx24.cc.monash.edu.au>
- Lines: 37
-
- In article <1992Sep8.154902.1@vx24.cc.monash.edu.au> edd701ssft@vx24.cc.monash.edu.au wrote:
- >
- >
- > Hi,
- >
- > I was wondering if it is at all possible to incorporate a sound playing
- > feature into my Visual Basic program (i.e. press a button that will
- > play a prerecorded digitised sound).
- >
- > If you have knowledge of such a technique I would greatly appreciate
- > you sharing it with me.
- >
- > Thanks.
- >
- > Please email your replies to :
- >
- > edd701ssft@vx24.cc.monash.edu.au
- >
- > Vincent,
- >
- > Monash University.
- >
-
- Piece of cake, assuming you have Windows 3.1 and a sound card (or
- at least the PC speaker driver, though your results with that may
- be a little disappointing).
-
- In your global module (or the declarations section of any form
- or module):
- Declare Function sndPlaySound Lib "MMSystem" (ByVal lpsound As String, ByVal flag As Integer) As Integer
-
- In your code:
- sndPlaySound "chimes.wav", 1
-
- That's it. If you don't provide a path in the string, Windows looks
- for it in your Windows directory. The second argument controls whether
- the sound is played synchronously or asynchronously.
-