Visual Basic midi

Discussion in 'С/С++, C#, Rust, Swift, Go, Java, Perl, Ruby' started by nikprim, 23 Apr 2011.

  1. nikprim

    nikprim New Member

    Joined:
    11 Dec 2009
    Messages:
    5
    Likes Received:
    0
    Reputations:
    0
    Делаю чтобы по нажатию кнопки воспроизводился midi файл

    Code:
    Public Class Form1
        Private Declare Function mciSendString Lib "winmm.dll" Alias "mciSendStringA" (ByVal lpstrCommand As String, ByVal lpstrReturnString As String, ByVal uReturnLength As Long, ByVal hwndCallback As Long) As Long
        Private Declare Function midiOutGetVolume Lib "winmm.dll" (ByVal uDeviceID As Long, ByVal lpdwVolume As Long) As Long
        Private Declare Function midiOutSetVolume Lib "winmm.dll" (ByVal uDeviceID As Long, ByVal dwVolume As Long) As Long
        Dim s As Long, RS As String, cb As Long, R
    
        Private Sub Command1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Command1.Click
            RS = Space$(128)
            'Здесь указываем путь к файлу, который следует воспроизвести
            R = ("c:\mm.mid")
            'Даем команду открыть файл
            s = mciSendString("open sequencer!" & R & " alias midi", RS, 128, cb)
            'Здесь даем команду проигрывать midi файл
            s = mciSendString("play midi", RS, 128, cb)
        End Sub
    End Class
    Выдает ошибку
    Code:
    A call to PInvoke function 'midiplay!midiplay.Form1::mciSendString' has unbalanced the stack. This is likely because the managed PInvoke signature does not match the unmanaged target signature. Check that the calling convention and parameters of the PInvoke signature match the target unmanaged signature.