O
Ole Olsen
so - an easy approach would be to make a ref. to the Visual Basic namespace
and use this function from within C#!
/Ole
and use this function from within C#!
/Ole
Ignacio Machin ( .NET/ C# MVP ) said:No,
You have to P/Invoke
The code I sent you works perfect
Will Pittenger said:There are no .NET equivalents?
----------
Will Pittenger
E-Mail: mailto:[email protected]
All mail filtered by Qurb (www.qurb.com)
"Ignacio Machin ( .NET/ C# MVP )" <ignacio.machin AT dot.state.fl.us> wrote
in message news:[email protected]...Hi Will,
Here is the code I"m using.
Cheers,
--
Ignacio Machin,
ignacio.machin AT dot.state.fl.us
Florida Department Of Transportation
//yyou need this namespace
using System.Runtime.InteropServices;
//P/invoke declarations
[DllImport("winmm.dll")]
public static extern int sndPlaySound(string lpszSoundName , int uFlags)
;
[DllImport("user32.dll")]
private static extern bool MessageBeep(int type);
//You use them like this:
MessageBeep( -1);
sndPlaySound( "file_to_play.wav" , 0);
I have a C# application that I would like to notify the user of events
with
sound. Is there a way to playback at least the standard sounds?
I would prefer something inside of .NET and have troubles believing that
Microsoft would not include sound in the .NET API. In general, I dislike
constantly importing Win32 stuff and then having to copy it everywhere I
need it. Either Microsoft should include all of Win32 in .NET (especially
if they keep calling .NET "better") or they should "preimport" all parts of
Win32 somewhere.