- This topic helps to check whether your system can play sound files or not using C#.
C# – How to check system can play sound file or not in C#
- C# is an Object Oriented Programming language from Microsoft that mainly combines the computing power of C++ with the programming ease of Visual Basic.
- C# is mainly based on C++.
- The most recent version is C#4.0.
- C# language is simple, modern, general-purpose, object-oriented language.
- Timer is a control available in Visual C#.NET
What is winmm.dll Library? - How to check system can play sound file or not in C#
- winmm.dll is a module for the Windows Multimedia API, which contains low-level audio and joystick functions.
- winmm.dll is a system process that is needed for your PC to work properly.
- winmm.dll should not be removed.
- winmm.dll doesn’t possess any harm to your system
- winmm.dll cannot be removed because it is system process.
- If winmm.dll returns a value greater than 0, then your system can play sound files.
- If it winmm.dll returns a value less than 0, then your system cannot play sound files.
- You have to declare a function for the winmm.dll library file, that function contains the value which decides whether the system can play sound file or not.
How to check system can play sound file or not in C# – Complete Code
public partial class Form1 : Form
[DllImport("winmm.dll", CharSet = CharSet.Auto, SetLastError = true, ExactSpelling = true)]
public static extern long GetNumDevs();
private void button1_Click(object sender, EventArgs e)
long I = 0;
I = GetNumDevs();
if (I > 0)
MessageBox .Show("Your system can play sound files.");
MessageBox.Show("Your system can not play sound files.");
How to check system can play sound file or not in C#