Share via

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

Hashim Idrees 21 Reputation points
Jun 22, 2023, 11:53 AM

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);
            }
        }
    }
}
C#
C#
An object-oriented and type-safe programming language that has its roots in the C family of languages and includes support for component-oriented programming.
11,146 questions
Visual Studio Debugging
Visual Studio Debugging
Visual Studio: A family of Microsoft suites of integrated development tools for building applications for Windows, the web and mobile devices.Debugging: The act or process of detecting, locating, and correcting logical or syntactical errors in a program or malfunctions in hardware. In hardware contexts, the term troubleshoot is the term more frequently used, especially if the problem is major.
1,012 questions
{count} votes

1 answer

Sort by: Most helpful
  1. Viorel 118.6K Reputation points
    Jun 22, 2023, 12:15 PM

    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.