Using the Windows API in .Net Languages

The following code demonstrates how to declare a Windows API function in C#. You can convert code between C# and VB.NET at this website.

using System.Runtime.InteropServices;

namespace Mup
{
    class MidiFile
    {
        [DllImport("winmm.dll")] 
        private static extern int mciSendString(string strCommand, 
            StringBuilder strReturn, int iReturnLength, IntPtr
            hwndCallback);

    }
}