473,799 Members | 2,885 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Default Beep

The following code will produce a sound in C# ...

using System.Runtime. InteropServices ;
Beep( 500, 500 );

[DllImport("kern el32.dll")]
private static extern bool Beep( int freq, int dur );

How can I play the sound associated with the System "Default Beep"?

--
-- Thom Little -- www.tlaNET.net -- Thom Little Associates, Ltd.
--

Nov 16 '05 #1
3 2901

"Thom Little" <th**@tlanet.ne t> wrote in message
news:er******** ******@TK2MSFTN GP10.phx.gbl...
The following code will produce a sound in C# ...

using System.Runtime. InteropServices ;
Beep( 500, 500 );

[DllImport("kern el32.dll")]
private static extern bool Beep( int freq, int dur );

How can I play the sound associated with the System "Default Beep"?
Best I can tell, you need to use PlaySound. This article describes its use,
converting it to a pinvoke shouldn't be too difficult:
http://msdn.microsoft.com/library/de...e_registry.asp

I believe SystemAsterisk is the name of the default windows beep.
--
-- Thom Little -- www.tlaNET.net -- Thom Little Associates, Ltd.
--

Nov 16 '05 #2
Thanks for the lead. Requesting any sound that is not defined gives the
Default Beep. The solution is ...

using System.Runtime. InteropServices ;

[DllImport("winm m.dll")]
public static extern long PlaySound( string lpszName, long hModule, long
dwFlags );

PlaySound( " ", 0, 0 );

Is it safe to assume that every Windows machines has winmm.dll installed or
should the PlaySound call be protected with a Try/Catch?

--
-- Thom Little -- www.tlaNET.net -- Thom Little Associates, Ltd.
--

"Daniel O'Connell [C# MVP]" <onyxkirx@--NOSPAM--comcast.net> wrote in
message news:%2******** ********@TK2MSF TNGP11.phx.gbl. ..

"Thom Little" <th**@tlanet.ne t> wrote in message
news:er******** ******@TK2MSFTN GP10.phx.gbl...
The following code will produce a sound in C# ...

using System.Runtime. InteropServices ;
Beep( 500, 500 );

[DllImport("kern el32.dll")]
private static extern bool Beep( int freq, int dur );

How can I play the sound associated with the System "Default Beep"?


Best I can tell, you need to use PlaySound. This article describes its
use, converting it to a pinvoke shouldn't be too difficult:
http://msdn.microsoft.com/library/de...e_registry.asp

I believe SystemAsterisk is the name of the default windows beep.

--
-- Thom Little -- www.tlaNET.net -- Thom Little Associates, Ltd.
--



Nov 16 '05 #3

"Thom Little" <th**@tlanet.ne t> wrote in message
news:uw******** ******@TK2MSFTN GP10.phx.gbl...
Thanks for the lead. Requesting any sound that is not defined gives the
Default Beep. The solution is ...

using System.Runtime. InteropServices ;

[DllImport("winm m.dll")]
public static extern long PlaySound( string lpszName, long hModule, long
dwFlags );

PlaySound( " ", 0, 0 );

Is it safe to assume that every Windows machines has winmm.dll installed
or should the PlaySound call be protected with a Try/Catch?


I think WiMM is pretty safe to rely on.

Nov 16 '05 #4

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

Similar topics

2
405
by: jmadsen | last post by:
I have created a subroutine that opens a report in design view, modifies the report (adds text boxes and grouping levels, etc.) then opens in preview mode. I want to be able to close the report without saving the changes, and without being prompted to save the changes. It is easy enough to get rid of the save prompt by using docmd.setwarnings=false; however, the default behavior of Access is to save the design changes. I can't seem to...
5
5324
by: Nothing | last post by:
Is there a way to turn off the defult menu bar? I do not want the user to see the File, Edit, View, etc. menu. How do you turn it off? Michael Charney *** Sent via Developersdex http://www.developersdex.com ***
10
2772
by: MLH | last post by:
I have an A97 table with a Yes/No field named TowJob and a form bound to that table. The TowJob control on the form is bound to the same field. It is an option group with Yes and No bttns valued at -1 and 0 respectively. Unless I specifically set the table field's defaultvalue to Null, the form comes up with an automatic value of 0 in the control? The control has NO default value property setting. Why is that?
8
5544
by: MLH | last post by:
What's the default declaration if Public/Private is ommited from the Sub statement in an Access 97 procedure?
6
7287
by: mcollier | last post by:
I have some VB6 code that calls a SELECT query in Microsoft Access. When I run the query from access, the results appear in not particular order. However, when I call the query from VB6, via ADO, the rows are returned in order by one particular column/field. There is no ORDER BY on the query. For example, in Access, the rows may be returned as: RowID ------ 1
3
1710
by: MLH | last post by:
Generally, I do not monkey with renaming controls on forms whose name, by default, matches the name of their related table fields. But I noticed the following today If IsNull(Me!VColor) Then DoCmd.CancelEvent SaveButtonClicked = False MyString = "You must tell us the color of the vehicle." MyString = MyString & "Please choose the vehicle color from " MyString = MyString & "the drop-down box provided on form."
6
1994
by: Robert_5032 | last post by:
when our users press "Search and Replace" all is fine exept that they ALWAYS have to change the criteria "Match the hole field" to "Part of the field" (ruffly spelled...(swedish lang)). -Is there anyway to change/ add some code so that the search dialogbox shows with this already done? That would make me happy Thank you for any clue! Robert
4
9955
by: =?Utf-8?B?UmljaA==?= | last post by:
When I press the Enter key in a Textbox I get a beep sound. But when I press the Enter key in a combobox, I don't get the beep sound. Is there a way to suppress the beep? How to do this? Thanks
6
2982
by: =?Utf-8?B?VmVybm9uIFBlcHBlcnM=?= | last post by:
I have an application that is designed for using with a bar code scanner. I want the user to know that the scan was complete and the data was entered, so I am playing a system sound after data entry. The data is being put into a text box, and a Return is sent after the data. I use the keypress event to capture the Return, and save the data. Then, I play the system sound, clear the text box, and set the focus back to the text box for the...
0
9685
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9538
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
10249
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10219
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9068
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...
0
6804
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
5461
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
2
3755
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2937
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.