- 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
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 |
using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.Text; using System.Windows.Forms; using System.Runtime.InteropServices; namespace WindowsFormsApplication1 { public partial class Form1 : Form { [DllImport("winmm.dll", CharSet = CharSet.Auto, SetLastError = true, ExactSpelling = true)] public static extern long GetNumDevs(); public Form1() { InitializeComponent(); } private void button1_Click(object sender, EventArgs e) { long I = 0; I = GetNumDevs(); if (I > 0) { MessageBox .Show("Your system can play sound files."); } else { MessageBox.Show("Your system can not play sound files."); } } } } |
How to check system can play sound file or not in C#






