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

Home Posts Topics Members FAQ

Stopping Default Sound from Playing

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 next entry.
When I do that, somewhere along the way, the default sound also plays. This
is disrupting my Exclamation sound, and not giving the audible notification
that I want. If there is a problem with the input for some reason, then I
have a message box popping up, and it gives the default sound also. Changing
the default sound does no good, as it would change the one being played when
the message box pops up. The user will not have anything to distinguish
between the good input and the bad input. What event is firing the default
sound, and can I turn it off, so that my Exclamation sound can be heard, or
can I set it to the Exclamation sound?
May 9 '07 #1
6 2980
On Wed, 9 May 2007 12:04:02 -0700, Vernon Peppers wrote:
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 next entry.
When I do that, somewhere along the way, the default sound also plays. This
is disrupting my Exclamation sound, and not giving the audible notification
that I want. If there is a problem with the input for some reason, then I
have a message box popping up, and it gives the default sound also. Changing
the default sound does no good, as it would change the one being played when
the message box pops up. The user will not have anything to distinguish
between the good input and the bad input. What event is firing the default
sound, and can I turn it off, so that my Exclamation sound can be heard, or
can I set it to the Exclamation sound?
For your second problem (exclamation sound when the MessageBox is shown),
simply do not show a MessageBox if you do not want any sound to play.
Instead, create your own Form (you can make it look like the standard
MessageBox and implement static methods to show it if you want, it's all
straightforward ) and show that instead. It won't play any sound.

Regarding your first problem, it isn't clear from your description why the
exclamation sound is played. Find out what exactly causes the default sound
to play and don't do that (just as with the MessageBox, find an alternative
way of doing whatever you want to do).
May 10 '07 #2
The only thing that I can find is that the sound plays when I exit the
KeyPress event method. I have stepped my code, and I get no default sound
until I execute the Exit Sub line. I have no idea what is causing the
default sound.

"Mehdi" wrote:
On Wed, 9 May 2007 12:04:02 -0700, Vernon Peppers wrote:
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 next entry.
When I do that, somewhere along the way, the default sound also plays. This
is disrupting my Exclamation sound, and not giving the audible notification
that I want. If there is a problem with the input for some reason, then I
have a message box popping up, and it gives the default sound also. Changing
the default sound does no good, as it would change the one being played when
the message box pops up. The user will not have anything to distinguish
between the good input and the bad input. What event is firing the default
sound, and can I turn it off, so that my Exclamation sound can be heard, or
can I set it to the Exclamation sound?

For your second problem (exclamation sound when the MessageBox is shown),
simply do not show a MessageBox if you do not want any sound to play.
Instead, create your own Form (you can make it look like the standard
MessageBox and implement static methods to show it if you want, it's all
straightforward ) and show that instead. It won't play any sound.

Regarding your first problem, it isn't clear from your description why the
exclamation sound is played. Find out what exactly causes the default sound
to play and don't do that (just as with the MessageBox, find an alternative
way of doing whatever you want to do).
May 10 '07 #3
On Thu, 10 May 2007 09:20:00 -0700, Vernon Peppers wrote:
The only thing that I can find is that the sound plays when I exit the
KeyPress event method. I have stepped my code, and I get no default sound
until I execute the Exit Sub line. I have no idea what is causing the
default sound.
If you're using a single-line textbox (ie. Multiline is set to false), then
pressing the Return key in the text box will cause Windows to emit a beep,
presumably to inform the user that they can't create new lines in the text
box.

It is not very clear what you are doing with your text box. From your
original description, it looks like the user is not actually typing
anything in the text box but that you're reading data using a bar code
reader, populating the textbox with the read data then insterting a Return
caracter at the end. And on top of that you're using the keypress event to
do I don't know what. I have trouble understanding what you are trying to
achieve. Why do you need to insert a Return caracter at the end of the data
in the text box? This caracter can not be seen anyway since it's a
single-line textbox so what's the point of adding it? If you don't add the
Return at the end, Windows won't beep.
May 11 '07 #4
The barcode scanner acts like a keyboard. The data is entered by the barcode
scanner. To all intents and purposes, the program can not tell the
difference between a scan from the barcode scanner, and input from the
keyboard. The Return character is sent by the barcode scanner to indicate
that the barcode is complete. If it is the Return that is causing the
problem, then I possibly could change the Return character to something else,
so that I could test for that character instead. The Return currently tells
the program that the barcode is complete, and to process that barcode, by
creating a new row in the data table, and populating the row with the
barcode, and other data from the input screen.

Since I don't have the scanner in my possession to reprogram it, is there
any way to turn this beep off?

"Mehdi" wrote:
On Thu, 10 May 2007 09:20:00 -0700, Vernon Peppers wrote:
The only thing that I can find is that the sound plays when I exit the
KeyPress event method. I have stepped my code, and I get no default sound
until I execute the Exit Sub line. I have no idea what is causing the
default sound.

If you're using a single-line textbox (ie. Multiline is set to false), then
pressing the Return key in the text box will cause Windows to emit a beep,
presumably to inform the user that they can't create new lines in the text
box.

It is not very clear what you are doing with your text box. From your
original description, it looks like the user is not actually typing
anything in the text box but that you're reading data using a bar code
reader, populating the textbox with the read data then insterting a Return
caracter at the end. And on top of that you're using the keypress event to
do I don't know what. I have trouble understanding what you are trying to
achieve. Why do you need to insert a Return caracter at the end of the data
in the text box? This caracter can not be seen anyway since it's a
single-line textbox so what's the point of adding it? If you don't add the
Return at the end, Windows won't beep.
May 11 '07 #5
On Fri, 11 May 2007 08:57:00 -0700, Vernon Peppers wrote:
The barcode scanner acts like a keyboard. The data is entered by the barcode
scanner. To all intents and purposes, the program can not tell the
difference between a scan from the barcode scanner, and input from the
keyboard. The Return character is sent by the barcode scanner to indicate
that the barcode is complete. If it is the Return that is causing the
problem, then I possibly could change the Return character to something else,
so that I could test for that character instead. The Return currently tells
the program that the barcode is complete, and to process that barcode, by
creating a new row in the data table, and populating the row with the
barcode, and other data from the input screen.

Since I don't have the scanner in my possession to reprogram it, is there
any way to turn this beep off?
Alright, I get it now. Well, I see 2 solutions:

- turning the beep off. There are hacks that allow you to turn it off
without modifying the system sound settings. I did it a while ago though
can't remember exactly what I did. However if you search Google Groups for
Textbox Return (or Enter) Beep, you'll find a lot of discusions about this.
You shouldn't have too much troubles switching off the beep.

- Set a default Accept button on your form. If your form has a default
Accept button, pressing Enter while in the textbox will press this button
instead of doing nothing and beeping. So you could maybe have an OK button
set as the Accept button of your form which, when pressed, would add the
new data in the datatable. Actually, using an Accept button will introduce
other problems (it will by default automatically set the DialogResult value
of your form which will cause it to close if it has been shown modally) so
if you've got your program already done and working the way you want the
best solution would probably be to just switch off the beeping sound
following Google Groups suggestions.
May 11 '07 #6
Thanks for the tip. Searching as you suggesting yielded the suggestion to
add the following line to my code that handled the Return keypress:

e.handled=True

That did it!

"Mehdi" wrote:
On Fri, 11 May 2007 08:57:00 -0700, Vernon Peppers wrote:
The barcode scanner acts like a keyboard. The data is entered by the barcode
scanner. To all intents and purposes, the program can not tell the
difference between a scan from the barcode scanner, and input from the
keyboard. The Return character is sent by the barcode scanner to indicate
that the barcode is complete. If it is the Return that is causing the
problem, then I possibly could change the Return character to something else,
so that I could test for that character instead. The Return currently tells
the program that the barcode is complete, and to process that barcode, by
creating a new row in the data table, and populating the row with the
barcode, and other data from the input screen.

Since I don't have the scanner in my possession to reprogram it, is there
any way to turn this beep off?

Alright, I get it now. Well, I see 2 solutions:

- turning the beep off. There are hacks that allow you to turn it off
without modifying the system sound settings. I did it a while ago though
can't remember exactly what I did. However if you search Google Groups for
Textbox Return (or Enter) Beep, you'll find a lot of discusions about this.
You shouldn't have too much troubles switching off the beep.

- Set a default Accept button on your form. If your form has a default
Accept button, pressing Enter while in the textbox will press this button
instead of doing nothing and beeping. So you could maybe have an OK button
set as the Accept button of your form which, when pressed, would add the
new data in the datatable. Actually, using an Accept button will introduce
other problems (it will by default automatically set the DialogResult value
of your form which will cause it to close if it has been shown modally) so
if you've got your program already done and working the way you want the
best solution would probably be to just switch off the beeping sound
following Google Groups suggestions.
May 11 '07 #7

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

Similar topics

2
4127
by: Josh | last post by:
I am having a problem with sound in my program, it takes information from a TargetDataLine, put's it in a temporary file, then takes it back out of the temporary file and plays it using a SourceDataLine. currently, it does not play back. andrewjj20 the play method: class Player implements Runnable { public Player() {
5
2132
by: Larry L | last post by:
I want to play a repetitive sound, and have a user click on a button each time it plays (say 5-10 times) and measure how far off he is from the sound each time. The only way I know to play a sound in JS is bgsound, and I know how to loop and pause, so as to do the 1st part. I haven't figured out how to then test the delay in response. Since some of the responses may also be *before* the sound plays by some milliseconds, that also...
7
6462
by: Lee Moody | last post by:
I just want quick and easy way to play a .wav file out the standard sound device. It could even be as simple as activating a sound assigned to an existing windows sound event. Any suggestions? Thanks in advance. -Lee
6
2668
by: blaine | last post by:
Hello, I'm currently overriding function keys (F1 to F4) to perform other actions. In order to do this the default popup windows of Help (F1), Seach(F3) etc must be turned off. In FF it's easy enought to do using the preventDefault and stopPropagation event functions. IE's equivalent is supposed to be cancelBubble and returnValue, however I can not seem to get them to stop no matter what I try.
4
5072
by: Benzerari | last post by:
Hi All; Please, if any one knows the visual basic code, to be added to a Stop button in order to stop playing some sound of (*.Wav) type. I have achieved to find the code for start playing sound or music which is: OLE.DoVerb (vbOLEPrimary) But the one to stop or interupt the sound I could not find it. Please let know
4
1693
by: gazza67 | last post by:
Hi, Does anyone know how to check for when a sound has finished playing? I am currently using the SoundPlayer, there doesnt seem to be any event for this - am I missing something? Gary
3
1906
by: thenath24 | last post by:
Hello all, I'm currently writing a 3D Game demo and i'm having trouble getting the program to play a sound and deal with a keystroke at the same time. If a sound is playing the program will wait for the sound to finish before dealing with a user input, this is obviously no good if I want music playing through out i've tried finding examples of how to do this but have had no luck, can anyone help??? Thanks in advance
3
7839
by: Jack | last post by:
Hi, I'm writing a simple wav player (like winamp) and using the SoundPlayer class in c# 2005. Using winform buttons, I can begin playing the sound and stop half-way through the sound using: myPlayer.Play() and myPlayer.Stop() methods which works great, but i want to know when the sound actually stops playing (so I can change my button's picture). If I raise a custom event after the myPlayer.Play()
4
4595
by: kid joe | last post by:
Hello I've got interested in learning some basic sound programming bits in C... mainly I want to know how to go about accessing the sound devices - reading from them mainly - in windows and linux... I'd kind of like to be able to do it without a whole bunch of extra garbage added in there - by this I mean that I know in windows there are a million sound programming packages that make the whole process "easier" - there are also a few in...
0
9496
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
10363
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...
1
10110
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
9961
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
5397
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...
0
5534
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4066
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
3669
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.