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 waveOutSetVolume
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
[DllImport("winmm.dll")] //引用winmm.dll
public static extern long waveOutSetVolume(uint deviceID, uint Volume); //参数为uint
private void Form1_Load(object sender, EventArgs e)
{
}
// trackBar 控件的最大值为0xffff,最小值为0x0000
private void trackBar1_Scroll(object sender, EventArgs e)
{
waveOutSetVolume(0, Convert.ToUInt16(trackBar1.Value));
}
}
}