CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 4 of 4
  1. #1
    Join Date
    May 2002
    Location
    Ukraine
    Posts
    228

    Question How to play sounds?

    I want to play some windows standard sound as an error alarm.
    How do it using C#?

    Thanks.

  2. #2
    Join Date
    Jul 1999
    Location
    Malmö, Sweden
    Posts
    126

    Re: How to play sounds?

    Hm, I don't think there is a way built in .NET, but, for example
    Code:
    [DllImport("winmm.dll")]
    public static extern long PlaySound(string lpszName, long hModule, long dwFlags);
    can be used. You can do likewise for Beep in the SDK, if all you want is a ... beep.

    Also, in .NET 2.0 you have Console.Beep() with one overload.

    And then there is ofcourse Windows Media Player to use :-)

    HTH!

  3. #3
    Join Date
    May 2002
    Location
    Ukraine
    Posts
    228

    Talking Re: How to play sounds?

    It is really strange.
    I hoped to find something as System. … .PlaySound…
    but not
    System.Diagnostics.Process.Start("ding.wav");

  4. #4
    Andy Tacker is offline More than "Just Another Member"
    Join Date
    Jun 2001
    Location
    55°50' N 37°39' E
    Posts
    1,503

    Re: How to play sounds?

    do a little bit search in this forum, you will find answers
    If you think you CAN, you can, If you think you CAN'T, you are probably right.

    Have some nice Idea to share? Write an Article Online or Email to us and You may WIN a Technical Book from CG.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured