473,786 Members | 2,350 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

System sound PlaySnd in VB.NET

Hi there,

Im trying to use the PlaySnd API to play a system sound, such as
"Asterisk" or "Question" within the windows section. Anyone got any ideas
on how this is done? I've tried using the SND_APPLICATION and SND_ALIAS
flags but I'm thinking that my name isnt correct in the first place, should
I be using "Windows\Asteri sk"? Thanks in advance.

--
Nick Pateman

---------------------------------------------------------------
Please do not reply directly to me, but the entire newsgroup.
Any views expressed above are my own
Without predjudice
Nov 21 '05 #1
5 4690
Okay well I've found some of the keys I need to use but not yet
unfortunately, for anyone elses reference you can achieve it via the
following,

Private Const SND_PURGE As Integer = &H40
Private Const SND_APPLICATION As Integer = &H80
Private Const SND_ASYNC As Integer = &H1

Private Declare Function PlaySound Lib "winmm.dll" Alias "PlaySoundA " (ByVal
lpszName As String, ByVal hModule As Integer, ByVal dwFlags As Integer) As
Integer

PlaySound(<name >, Nothing, SND_PURGE Or SND_ASYNC Or SND_APPLICATION )

<name> - SystemAsterisk
<name> - SystemHand
<name> - SystemExclamati on
<name> - SystemQuestion

..... Still looking for more..

Nick.

"Nick" <no****@nospam. com> wrote in message
news:Ot******** ******@TK2MSFTN GP15.phx.gbl...
Hi there,

Im trying to use the PlaySnd API to play a system sound, such as
"Asterisk" or "Question" within the windows section. Anyone got any ideas
on how this is done? I've tried using the SND_APPLICATION and SND_ALIAS
flags but I'm thinking that my name isnt correct in the first place,
should I be using "Windows\Asteri sk"? Thanks in advance.

--
Nick Pateman

---------------------------------------------------------------
Please do not reply directly to me, but the entire newsgroup.
Any views expressed above are my own
Without predjudice

Nov 21 '05 #2
"Nick" <no****@nospam. com> schrieb:
Im trying to use the PlaySnd API to play a system sound, such as
"Asterisk" or "Question" within the windows section. Anyone got any ideas
on how this is done? I've tried using the SND_APPLICATION and SND_ALIAS
flags but I'm thinking that my name isnt correct in the first place,
should I be using "Windows\Asteri sk"? Thanks in advance.


I am curious why you do not use 'MessageBeep':

Implementing a message box with standard behavior
<URL:http://dotnet.mvps.org/dotnet/faqs/?id=custommsgbo x&lang=en>

--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://classicvb.org/petition/>

Nov 21 '05 #3
There is an example of using SndPlaySnd in Windows Forms Tips and Tricks.
The constants for the operations are also included.

--
Bob Powell [MVP]
Visual C#, System.Drawing

Ramuseco Limited .NET consulting
http://www.ramuseco.com

Find great Windows Forms articles in Windows Forms Tips and Tricks
http://www.bobpowell.net/tipstricks.htm

Answer those GDI+ questions with the GDI+ FAQ
http://www.bobpowell.net/faqmain.htm

All new articles provide code in C# and VB.NET.
Subscribe to the RSS feeds provided and never miss a new article.

"Nick" <no****@nospam. com> wrote in message
news:Ot******** ******@TK2MSFTN GP15.phx.gbl...
Hi there,

Im trying to use the PlaySnd API to play a system sound, such as
"Asterisk" or "Question" within the windows section. Anyone got any ideas
on how this is done? I've tried using the SND_APPLICATION and SND_ALIAS
flags but I'm thinking that my name isnt correct in the first place,
should I be using "Windows\Asteri sk"? Thanks in advance.

--
Nick Pateman

---------------------------------------------------------------
Please do not reply directly to me, but the entire newsgroup.
Any views expressed above are my own
Without predjudice

Nov 21 '05 #4
Hi Herfried,

Cheers! I didn't actually know this existed! Thanks for your help.

Nick.

"Herfried K. Wagner [MVP]" <hi************ ***@gmx.at> wrote in message
news:uz******** ******@TK2MSFTN GP12.phx.gbl...
"Nick" <no****@nospam. com> schrieb:
Im trying to use the PlaySnd API to play a system sound, such as
"Asterisk" or "Question" within the windows section. Anyone got any
ideas on how this is done? I've tried using the SND_APPLICATION and
SND_ALIAS flags but I'm thinking that my name isnt correct in the first
place, should I be using "Windows\Asteri sk"? Thanks in advance.


I am curious why you do not use 'MessageBeep':

Implementing a message box with standard behavior
<URL:http://dotnet.mvps.org/dotnet/faqs/?id=custommsgbo x&lang=en>

--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://classicvb.org/petition/>

Nov 21 '05 #5
Hi Bob,

Cheers for the info, Herfried just pointed out an API I didn't know
existed, which is most helpful. Cheers again.

Nick.

"Bob Powell [MVP]" <bob@_spamkille r_bobpowell.net > wrote in message
news:Oo******** *****@TK2MSFTNG P09.phx.gbl...
There is an example of using SndPlaySnd in Windows Forms Tips and Tricks.
The constants for the operations are also included.

--
Bob Powell [MVP]
Visual C#, System.Drawing

Ramuseco Limited .NET consulting
http://www.ramuseco.com

Find great Windows Forms articles in Windows Forms Tips and Tricks
http://www.bobpowell.net/tipstricks.htm

Answer those GDI+ questions with the GDI+ FAQ
http://www.bobpowell.net/faqmain.htm

All new articles provide code in C# and VB.NET.
Subscribe to the RSS feeds provided and never miss a new article.

"Nick" <no****@nospam. com> wrote in message
news:Ot******** ******@TK2MSFTN GP15.phx.gbl...
Hi there,

Im trying to use the PlaySnd API to play a system sound, such as
"Asterisk" or "Question" within the windows section. Anyone got any
ideas on how this is done? I've tried using the SND_APPLICATION and
SND_ALIAS flags but I'm thinking that my name isnt correct in the first
place, should I be using "Windows\Asteri sk"? Thanks in advance.

--
Nick Pateman

---------------------------------------------------------------
Please do not reply directly to me, but the entire newsgroup.
Any views expressed above are my own
Without predjudice


Nov 21 '05 #6

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

Similar topics

1
1398
by: Lovens | last post by:
I would like to know how to play a system sound like for exemple the "beeping" sound often heard in Windows... What I want to do is pretty simple. I have a dialog and when the user click on the "Ok" button if the values entered are not good than we hear a beeing sound and the dialog displays again... So I only want to know how to play the sound in question. thanx in adavance..
3
4239
by: MLH | last post by:
I make API calls to the sndPlaySound function, something like this... XX% = sndPlaySound(msound, MyParm) Several predefined system constants (or API intrinsic constants) have been recommended for use as the 2nd parm... SND_ASYNC
0
1503
by: Richy | last post by:
Hi again, I have run into a problem with the System.Media.Soundplayer class, notably the Play method. The sound that plays gets garbled about 50% of the time, usually at the end, when it finishes with white noise or a high pitch noise. If I use PlaySync it plays it fine. I COULD create a thread and execute the Play method via the thread, but that leaves me with the problem of stopping the sound. Terminating the thread doesn't kill the...
9
5611
by: Morris Neuman | last post by:
Im working with VS 2005 and trying to use a Hyperlink field in a datagrid to play a wave file that is not located in the website folders but is in a plain folder on the same machine, windows 2003 server, WMP 10.0 . If I type the full path in an IE address field it plays the file in WMP When I test my Web page ( running the debugger in VS.) The datagrid has a column called "MsgFile" with the full path to the wave file e.g....
0
1069
by: midmukesh | last post by:
Hi, I am Mukesh, I have prepared an web application in ASP.NET 2003, And I want that, when user / client will open the link of my site, the system of that user will automatically be checked and will be detected weather sound is installed or not on that system. And if it will, then sound level of that system will also be checked, and will be informed to the user that sound is mute or not. I hope, This breifing would have made picture cleare...
7
2959
by: w33bster | last post by:
Hello, I want to build a php based webserver that can act as a playlist editor and play mp3's through the sound system on the server through an itrip like device that will allow it to be picked up on fm radios around the house. I've got the whole thing sorted apart from the minor point of accessing the sound system!?!
9
6487
Atran
by: Atran | last post by:
Hello everybody, can anyone till me: What we can do in System.ComponentModel If you can give me easy example too. Thanks for anyhelp.
2
2088
by: Z1P2 | last post by:
Hello, I'm trying to find a way to replace the user's alert system sound with a custom sound in the following script. Can someone please point me in the right direction? <script type="text/javascript"> var monitor = setTimeout("alert('The monitor is working');",0); </script>
5
2823
by: Bill | last post by:
Hi Is it possible to trigger a sound upon hovering a link but without the use of winamp or another client ? thks
0
9492
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10360
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8988
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7510
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6744
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5532
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4064
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3668
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2894
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.