| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 2170 人关注过本帖
标题:大家一起找BUG,这个问题对我太顽固,三天没找到原因!
只看楼主 加入收藏
lianghong
Rank: 1
等 级:新手上路
帖 子:3
专家分:0
注 册:2018-2-16
收藏
 问题点数:0 回复次数:1 
大家一起找BUG,这个问题对我太顽固,三天没找到原因!
'环境:Win10   
'请大家一起找BUG!!!!
'mixerGetLineInfo一直返回错误11,我找不到原因,我反复检查了输入参数,没问题呀!
'下面是我的代码:
Imports System.Runtime.InteropServices
Public Class Form1
    Private mhMixer As Integer
    Private Const MMSYSERR_NOERROR = &H0
    Private Const MMSYSERR_INVALPARAM = &HB       '{一个或多个参数无效}
    Private Const MIXER_GETLINEINFOF_COMPONENTTYPE = &H3
    Private Const MIXERLINE_COMPONENTTYPE_DST_SPEAKERS = &H4
    <StructLayoutAttribute(LayoutKind.Sequential, CharSet:=CharSet.Ansi, Pack:=1)> _
   Structure MIXERLINE
        Dim cbStruct As Integer
        Dim dwDestination As Integer
        Dim dwSource As Integer
        Dim dwLineID As Integer
        Dim fdwLine As Integer
        Dim dwUser As Integer
        Dim dwComponentType As Integer
        Dim cChannels As Integer
        Dim cConnections As Integer
        Dim cControls As Integer
        <MarshalAs(UnmanagedType.ByValTStr, SizeConst:=16)> _
        Dim szShortName As String
        <MarshalAs(UnmanagedType.ByValTStr, SizeConst:=64)> _
        Dim szName As String
        Dim dwType As Integer
        Dim dwDeviceID As Integer
        Dim wMid As Short
        Dim wPid As Short
        Dim vDriverVersion As Integer
        <MarshalAs(UnmanagedType.ByValTStr, SizeConst:=32)> _
        Dim szPname As String
    End Structure
    Public Declare Function mixerOpen Lib "winmm.dll" _
         (ByRef phmx As Integer, ByVal uMxId As Integer, ByVal dwCallback As IntPtr, _
         ByVal dwInstance As Integer, ByVal fdwOpen As Integer) As Int32
    Private Declare Function mixerGetLineInfo Lib "winmm.dll" _
         Alias "mixerGetLineInfoA" (ByVal hmxobj As Integer, ByRef pmxl As MIXERLINE, ByVal fdwInfo As Int32) As Integer
    Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        Call GetControlID()
    End Sub

    '取得Mixer控制的ID  如: Volume
    Private Function GetControlID() As Boolean
        Dim Ret As Integer
        Dim MxrLine As New MIXERLINE
        Ret = mixerOpen(mhMixer, 0, 0, 0, 0)
        If Ret = MMSYSERR_NOERROR Then
            MxrLine.cbStruct = Marshal.SizeOf(MxrLine)
            MxrLine.dwComponentType = MIXERLINE_COMPONENTTYPE_DST_SPEAKERS  '
            Ret = mixerGetLineInfo(mhMixer, MxrLine, MIXER_GETLINEINFOF_COMPONENTTYPE)
            If Ret = MMSYSERR_NOERROR Then
                Return True
            Else
                If Ret = MMSYSERR_INVALPARAM Then Return False Else Return False '求原因
            End If
        End If
    End Function
End Class
搜索更多相关主题的帖子: Private Integer Dim ByVal Ret 
2018-02-16 13:55
lianghong
Rank: 1
等 级:新手上路
帖 子:3
专家分:0
注 册:2018-2-16
收藏
得分:0 
运行结果如图:
图片附件: 游客没有浏览图片的权限,请 登录注册
2018-02-16 23:49
快速回复:大家一起找BUG,这个问题对我太顽固,三天没找到原因!
数据加载中...
 
   



关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.016259 second(s), 9 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved