Wrox Programmer Forums

Need to download code?

View our list of code downloads.

| FAQ | Members List | Search | Today's Posts | Mark Forums Read
Pro VB.NET 2002/2003 For advanced Visual Basic coders working .NET version 2002/2003. Beginning-level questions will be redirected to other forums, including Beginning VB.NET.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Pro VB.NET 2002/2003 section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old October 6th, 2005, 10:04 PM
Registered User
Join Date: Oct 2005
Location: , , .
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default sound

I need a very easy way to play a sound without opening other programs. Help!!

Reply With Quote
  #2 (permalink)  
Old December 7th, 2005, 04:54 PM
Friend of Wrox
Join Date: Nov 2004
Location: Port Orchard, WA, USA.
Posts: 1,621
Thanks: 1
Thanked 3 Times in 3 Posts

From Help:
Public Class SoundClass

   Declare Auto Function PlaySound Lib "winmm.dll" (ByVal name _
      As String, ByVal hmod As Integer, ByVal flags As Integer) As Integer

   ' name   specifies the sound file when the SND_FILENAME flag is set.
   ' hmod   specifies an executable file handle.
   ' hmod   must be Nothing if the SND_RESOURCE flag is not set.
   ' flags  specifies which flags are set. 

   ' The PlaySound documentation lists all valid flags.
   Public Const SND_SYNC = &H0          ' play synchronously
   Public Const SND_ASYNC = &H1         ' play asynchronously
   Public Const SND_FILENAME = &H20000  ' name is file name
   Public Const SND_RESOURCE = &H40004  ' name is resource name or atom

   ' Following method plays a sound from filename.
   Public Sub PlaySoundFile(ByVal filename As String)

      PlaySound(filename, Nothing, SND_FILENAME Or SND_ASYNC)

   End Sub

End Class

Private Sub Button1_Click(ByVal sender As System.Object, _
      ByVal e As System.EventArgs) Handles Button1.Click

   Dim SoundInst As New SoundClass()


End Sub
Reply With Quote

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Sound Frequency angelboy C# 2005 1 June 9th, 2009 01:21 AM
sound mohand Visual Basic 2005 Basics 1 November 27th, 2007 05:03 PM
Sound recorder kesitinhluoibieng Visual C++ 1 December 31st, 2006 09:08 AM
Sound on/off Adam H-W Flash (all versions) 1 June 27th, 2003 03:21 PM
Sound on demand Bill Javascript 2 June 10th, 2003 01:34 AM

All times are GMT -4. The time now is 06:56 PM.

Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.