Visual Studio code error unable to load DLL :winmm.dll"

Hashim Idrees 21 Reputation points
2023-06-22T11:53:27.7433333+00:00

Can you Please Help me fix this issue. I am beginner to it.

I have shared the Pic and code.

Thanks for help

Untitled

using System;
using System.Windows.Forms;
using System.Runtime.InteropServices;
namespace Dispatch_Command_Training_Assist
{
    public partial class Form1: Form
    {
        [DllImport("winmm.d11", EntryPoint = "mciSendStringA", ExactSpelling = true, CharSet = CharSet.Ansi, SetLastError = true)]
        public static extern int myfunc(string a, string b, int c, int d);
        public Form1()
        {
            InitializeComponent();
        }
        public void StartRecording_Click(object sender, EventArgs e)
        {
            myfunc("open new type waveaudio Alias recsound", "", 0, 0);
            myfunc("record recsound", null, 0, 0);
            StartRecording.Text = "    Recording....";
            StartRecording.ForeColor = System.Drawing.Color.Red;
        }
        public void StopRecording_Click(object sender, EventArgs e)
        {
            myfunc("pause recsound", null, 0, 0);
            SaveFileDialog sfd = new SaveFileDialog();
            sfd.Filter = "wave|*.wav";
            if(sfd.ShowDialog() == DialogResult.OK)
            {
                myfunc("save recsound" + sfd.FileName, null, 0, 0);
                myfunc("close recsound", null, 0, 0);
            }
        }
    }
}
Developer technologies Visual Studio Debugging
Developer technologies C#
{count} votes

1 answer

Sort by: Most helpful
  1. Viorel 122.5K Reputation points
    2023-06-22T12:15:49.44+00:00

    Try "winmm.dll" or "winmm.DLL" instead of "winmm.d11".

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.