Re: Default Beep
From: Thom Little (thom_at_tlanet.net)
Date: 09/17/04
- Next message: Duncan Mole: "Re: How to retrieve serial number of OS or CPU for copy protection?"
- Previous message: Drebin: "Re: \n?? \r??"
- In reply to: Daniel O'Connell [C# MVP]: "Re: Default Beep"
- Next in thread: Daniel O'Connell [C# MVP]: "Re: Default Beep"
- Reply: Daniel O'Connell [C# MVP]: "Re: Default Beep"
- Messages sorted by: [ date ] [ thread ]
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.
>> --
>>
>>
>>
>
>
- Next message: Duncan Mole: "Re: How to retrieve serial number of OS or CPU for copy protection?"
- Previous message: Drebin: "Re: \n?? \r??"
- In reply to: Daniel O'Connell [C# MVP]: "Re: Default Beep"
- Next in thread: Daniel O'Connell [C# MVP]: "Re: Default Beep"
- Reply: Daniel O'Connell [C# MVP]: "Re: Default Beep"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|