问题1:textBox1.Text显示为0
问题2:MMRESULT waveInGetDevCaps(
UINT_PTR uDeviceID,
LPWAVEINCAPS pwic,
UINT cbwic
);
中cbwic应该输多少??有点看不懂MSDN上的解释
源代码如下:
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using System.Runtime.InteropServices;
namespace Apifight2
{
[StructLayout(LayoutKind.Sequential)]
public struct WAVEINCAPS {
public int wMid;
public int wPid;
public uint vDriverVersion;
public string szPname; //
public int dwFormats;
public int wChannels;
public int wReserved1;
} public enum ID{
WAVE_MAPPER=-1,
} public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
} [DllImport("Winmm")] static extern uint waveInGetDevCaps(ID uDeviceID, WAVEINCAPS pwic, int cbwic ); private void button1_Click(object sender, EventArgs e)
{
try
{
WAVEINCAPS waveincaps=new WAVEINCAPS();
waveInGetDevCaps(ID.WAVE_MAPPER, waveincaps, Marshal.SizeOf(waveincaps));
textBox1.Text = waveincaps.vDriverVersion.ToString();
} catch (Exception er)
{ MessageBox.Show(er.Message); }
}
}
}
问题2:MMRESULT waveInGetDevCaps(
UINT_PTR uDeviceID,
LPWAVEINCAPS pwic,
UINT cbwic
);
中cbwic应该输多少??有点看不懂MSDN上的解释
源代码如下:
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using System.Runtime.InteropServices;
namespace Apifight2
{
[StructLayout(LayoutKind.Sequential)]
public struct WAVEINCAPS {
public int wMid;
public int wPid;
public uint vDriverVersion;
public string szPname; //
public int dwFormats;
public int wChannels;
public int wReserved1;
} public enum ID{
WAVE_MAPPER=-1,
} public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
} [DllImport("Winmm")] static extern uint waveInGetDevCaps(ID uDeviceID, WAVEINCAPS pwic, int cbwic ); private void button1_Click(object sender, EventArgs e)
{
try
{
WAVEINCAPS waveincaps=new WAVEINCAPS();
waveInGetDevCaps(ID.WAVE_MAPPER, waveincaps, Marshal.SizeOf(waveincaps));
textBox1.Text = waveincaps.vDriverVersion.ToString();
} catch (Exception er)
{ MessageBox.Show(er.Message); }
}
}
}
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货