Re: Default Beep

Tech Tip: Click here to run a free scan for Windows Errors and optimize PC performance

From: Thom Little (thom_at_tlanet.net)
Date: 09/17/04


Date: Fri, 17 Sep 2004 12:31:09 -0400

Thanks for the lead. Requesting any sound that is not defined gives the
Default Beep. The solution is ...

using System.Runtime.InteropServices ;

[DllImport("winmm.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:%23ITYlCHnEHA.3756@TK2MSFTNGP11.phx.gbl...
>
> "Thom Little" <thom@tlanet.net> wrote in message
> news:erhQzuCnEHA.3296@TK2MSFTNGP10.phx.gbl...
>> The following code will produce a sound in C# ...
>>
>> using System.Runtime.InteropServices;
>> Beep( 500, 500 );
>>
>> [DllImport("kernel32.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/default.asp?url=/library/en-us/multimed/htm/_win32_playing_sounds_specified_in_the_registry.asp
>
> I believe SystemAsterisk is the name of the default windows beep.
>>
>> -- 
>> -- Thom Little -- www.tlaNET.net -- Thom Little Associates, Ltd.
>> --
>>
>>
>>
>
>


Relevant Pages

  • Re: OT - PC makes odd beeping sound
    ... to do with the soundcard. ... because on every version of OE I've ever used, the beep is the default ... and you have to switch it off. ... My understanding is that OE is playing a sound via the ...
    (uk.media.tv.misc)
  • Re: continuous system speaker from booting on
    ... The problem sounds like it could be hardware - and in a laptop, ... I don't know if he is sure the tone is coming from the ... sound system speakers or the beeper on the mainboard - but I also am not ... on the mainboard and could provide the beep code warnings (from post ...
    (Ubuntu)
  • Re: continuous system speaker from booting on
    ... The problem sounds like it could be hardware - and in a laptop, ... I don't know if he is sure the tone is coming from the ... sound system speakers or the beeper on the mainboard - but I also am not ... on the mainboard and could provide the beep code warnings (from post ...
    (Ubuntu)
  • Re: A Riddle for Relativists.
    ... For every 7E14 cycles of that light, the source emits a short beep of sound. ... A detector at rest with the source and some distance away counts the beeps and ... This implies that the detector is now receiving twice the number of light ...
    (sci.physics.relativity)
  • Re: A Riddle for Relativists.
    ... For every 7E14 cycles of that light, the source emits a short beep of sound. ... A detector at rest with the source and some distance away counts the beeps and ... This implies that the detector is now receiving twice the number of light ...
    (sci.physics.relativity)