473,324 Members | 2,511 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,324 software developers and data experts.

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\Asterisk"? 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 4673
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> - SystemExclamation
<name> - SystemQuestion

..... Still looking for more..

Nick.

"Nick" <no****@nospam.com> wrote in message
news:Ot**************@TK2MSFTNGP15.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\Asterisk"? 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\Asterisk"? 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=custommsgbox&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**************@TK2MSFTNGP15.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\Asterisk"? 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**************@TK2MSFTNGP12.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\Asterisk"? 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=custommsgbox&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@_spamkiller_bobpowell.net> wrote in message
news:Oo*************@TK2MSFTNGP09.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**************@TK2MSFTNGP15.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\Asterisk"? 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
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...
3
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...
0
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...
9
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...
0
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...
7
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...
9
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
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...
5
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
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

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.