求助vb.net控制midi
本人使用的是vs2005,使用vb.net来开发一个控制midi发声的程序。
我想点击按钮就发一个声音。我在vb6.0的源码中看到这样写,点击可以发声,但是在vb.net中却不能,求教各位啊。
Private Declare Function midiOutShortMsg Lib "winmm.dll" (ByVal hMidiOut As Long, ByVal dwMsg As Long) As Long
Private Declare Function midiOutOpen Lib "winmm.dll" (ByVal lphMidiOut As Long, ByVal uDeviceID As Long, ByVal dwCallback As Long, ByVal dwInstance As Long, ByVal dwFlags As Long) As Long
Private Declare Function midiOutClose Lib "winmm.dll" (ByVal hMidiOut As Long) As Long
Private Declare Sub Sleep Lib "kernel32" (ByVal dwMilliseconds As Long)
Dim hMidi1 As Long
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
midiOutOpen(hMidi1, -1, 0, 0, 0)
Dim Tone As Byte
Dim volume As Long
Dim channel As Long
channel = 0
volume = 127
Tone = Val("50")
Call midiOutShortMsg(hMidi1, channel + volume * &H10000 + Tone * &H100 + &H90)
End Sub
为什么在vb6中就可以,在vb.net2005中却不可以。求教各位了 VB.NET Visual?Basic?6.0
[解决办法]
你对照一下这个,看看是不是api声明不正确
[解决办法]
VB6使用API声明中的所有Long,在vb.net的声明中都得换成integer