473,386 Members | 1,757 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

Play standard sound

Hi,

how can I play a windows standard sound (like the one when an error occurrs)
out of my vb.net project?

Thanks
Peter
Jul 21 '05 #1
2 1269
Hi Peter,
Declare this before the form's load event:
Private Declare Function PlaySound _

Lib "WINMM.DLL" Alias "sndPlaySoundA" _

(ByVal lpszSoundName As String, _

ByVal uFlags As Long) As Long

Private Enum playsoundflags

async = &H1

sync = &H0

End Enum

Then call it like this:

PlaySound("c:\mozart3.wav", playsoundflags.async)

HTH,

Bernie Yaeger

"Peter Schmitz" <Pe**********@discussions.microsoft.com> wrote in message
news:74**********************************@microsof t.com...
Hi,

how can I play a windows standard sound (like the one when an error
occurrs)
out of my vb.net project?

Thanks
Peter

Jul 21 '05 #2
Or, you can look into using managed DirectX (9.*) for more control.
--
Dave Sexton
dave@www..jwaonline..com
-----------------------------------------------------------------------
"Bernie Yaeger" <be*****@cherwellinc.com> wrote in message news:eK**************@TK2MSFTNGP14.phx.gbl...
Hi Peter,
Declare this before the form's load event:
Private Declare Function PlaySound _

Lib "WINMM.DLL" Alias "sndPlaySoundA" _

(ByVal lpszSoundName As String, _

ByVal uFlags As Long) As Long

Private Enum playsoundflags

async = &H1

sync = &H0

End Enum

Then call it like this:

PlaySound("c:\mozart3.wav", playsoundflags.async)

HTH,

Bernie Yaeger

"Peter Schmitz" <Pe**********@discussions.microsoft.com> wrote in message
news:74**********************************@microsof t.com...
Hi,

how can I play a windows standard sound (like the one when an error occurrs)
out of my vb.net project?

Thanks
Peter


Jul 21 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

6
by: Andrew Poulos | last post by:
As a follow on to the 'fun' I had with IE I'm now trying to play sounds using an Object tag (no Embed) in MZ. Sadly whenever 'playButton' gets clicked MZ says that "audObj.Play is not a function":...
1
by: Ron Provost | last post by:
Hello, I'm developing a piece of software to assist illiteraate adults to learn to read. I'm trying to figure out how, if possible, to make audio playback asynchrnous but still controllable. ...
2
by: NB | last post by:
I've done a thorough search, but could not find any posts If I store a sound file within the mdb, How do I play it (in a form event, for example) I can save it to a temp folder and call the...
22
by: MLH | last post by:
I have some audio help files that play fine from within Access 97 and Access 2.0. Both are running on a Windows XP box. But I do not know what program plays the files. If I click Start, Run and...
5
by: Dennis C. Drumm | last post by:
I have a windows form configured as a fixed dialog I'm using as a custom MessageBox (has some additional buttons). How do I get it to play the standard windows sounds when envoked and can I insert...
1
by: Lam | last post by:
how can I play sound file in a .aspx page written in C#? I try to use the code like the following. But whenI call the play function play("sound.wav", this.SND_ASYNC) my computer give out "be"...
3
by: Jared | last post by:
I'm using the first code sample below to play WAV files stored as embedded resources. For some reason I *occasionally* get scratching and crackling. I'm using a couple WAVs that ship with...
10
ADezii
by: ADezii | last post by:
Most Access Users fail to realize that they can significantly enhance their applications by introducing various sounds (*.WAVs) in response to specific events. The only intrinsic sound that Access...
5
by: | last post by:
Hello, I am wrtting a program that does some sound effects... the files are stored in a subfolder in the application folder... and I check the existence of the files before calling the method to...
26
by: Jake Barnes | last post by:
I did a search on the newsgroup comp.lang.javascript. I was searching for "how to play a sound with Javascript". I'm somewhat suprised that the majority of entries are from the 1990s, and there are...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.