16,721
社区成员
发帖
与我相关
我的任务
分享
我在网上找到的mixerOpen的定义,楼主可以试试把mixerOpen的声明改一下看看结果。先调用mixerOpen,再调用mixerGetLineInfo。
Public Declare Function mixerOpen Lib "winmm.dll" _
(ByRef phmx As Integer, ByVal uMxId As Integer, ByVal dwCallback As IntPtr, _
ByVal dwInstance As IntPtr, ByVal fdwOpen As Integer) As Int32




Private Function GetControlID() As Boolean
Dim Ret As Integer
Dim MxrLine As New MIXERLINE
Ret = mixerOpen(mhMixer, 0, 0, 0, 0)
If Ret = CType(MMSYSERR_NOERROR, Integer) Then
MxrLine.cbStruct = Marshal.SizeOf(MxrLine)
MxrLine.dwComponentType = MIXERLINE_COMPONENTTYPE_DST_SPEAKERS '
Ret = mixerGetLineInfo(mhMixer, MxrLine, MIXER_GETLINEINFOF_COMPONENTTYPE)
If Ret = CType(MMSYSERR_NOERROR, Integer) Then
Return True
Else
If Ret = CType(MMSYSERR_INVALPARAM, Integer) Then Return False Else Return False '求原因
End If
End If
End Function
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
'Call GetControlID()
Dim result As Boolean
result = GetControlID()
MessageBox.Show("Execute result:" + result.ToString())
End Sub
我这里,返回是True,你的函数里,有2个地方都返回True,最好能细化
