Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 160549
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T11:03:17+00:00 2026-05-11T11:03:17+00:00

How do I play the New Mail system sound in C#? This is also

  • 0

How do I play the ‘New Mail’ system sound in C#? This is also called the ‘Notify’ sound.

In Win32, that would be something like

sndPlaySound('Notify', (SND_ALIAS or SND_ASYNC)); 

So how do you do that in .Net? I know that you can do

System.Media.SystemSounds.Asterisk.Play(); 

But there’s a very limited set of five sounds there – not including whatever the the user has set as the new mail sound.

I can find out which .wav file is being played when I get new mail and play that file, but that won’t update when the user’s sound scheme is changed.


What I eventually did:

Instead of playing a system sound, I embedded a wav file into the application as a resource, and played it with System.Media.SoundPlayer

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. 2026-05-11T11:03:17+00:00Added an answer on May 11, 2026 at 11:03 am

    One option is to just PInvoke directly into the sndSound API. Here is the PInvoke definition for that method

    public partial class NativeMethods {      /// Return Type: BOOL->int     ///pszSound: LPCWSTR->WCHAR*     ///fuSound: UINT->unsigned int     [System.Runtime.InteropServices.DllImportAttribute('winmm.dll', EntryPoint='sndPlaySoundW')]     [return: System.Runtime.InteropServices.MarshalAsAttribute(System.Runtime.InteropServices.UnmanagedType.Bool)] public static extern  bool sndPlaySoundW([System.Runtime.InteropServices.InAttribute()] [System.Runtime.InteropServices.MarshalAsAttribute(System.Runtime.InteropServices.UnmanagedType.LPWStr)] string pszSound, uint fuSound) ;      /// SND_APPLICATION -> 0x0080     public const int SND_APPLICATION = 128;      /// SND_ALIAS_START -> 0     public const int SND_ALIAS_START = 0;      /// SND_RESOURCE -> 0x00040004L     public const int SND_RESOURCE = 262148;      /// SND_FILENAME -> 0x00020000L     public const int SND_FILENAME = 131072;      /// SND_ALIAS_ID -> 0x00110000L     public const int SND_ALIAS_ID = 1114112;      /// SND_NOWAIT -> 0x00002000L     public const int SND_NOWAIT = 8192;      /// SND_NOSTOP -> 0x0010     public const int SND_NOSTOP = 16;      /// SND_MEMORY -> 0x0004     public const int SND_MEMORY = 4;      /// SND_PURGE -> 0x0040     public const int SND_PURGE = 64;      /// SND_ASYNC -> 0x0001     public const int SND_ASYNC = 1;      /// SND_ALIAS -> 0x00010000L     public const int SND_ALIAS = 65536;      /// SND_SYNC -> 0x0000     public const int SND_SYNC = 0;      /// SND_LOOP -> 0x0008     public const int SND_LOOP = 8;      /// SND_NODEFAULT -> 0x0002     public const int SND_NODEFAULT = 2; } 
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Ask A Question

Stats

  • Questions 68k
  • Answers 68k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • added an answer 'Efficient' is not a catch-all term. An array-of-arrays solution is… May 11, 2026 at 12:22 pm
  • added an answer I have managed to track down the problem. I was… May 11, 2026 at 12:22 pm
  • added an answer I tried reproducing the problem, but the code just takes… May 11, 2026 at 12:22 pm

Related Questions

How do I make the most out of a MS in Business Analytics?
How do I tell my new employer that I can’t use the computer they gave me?
How do I store binary data in MySQL ?
I want to use git to allow me to work on several features in
I want to use the new report builder 2.0, rather than the old VS2005
After seeing the cool new reputation tab on the stackoverflow user page, I was

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.