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 Media
{
public partial class Form1 : Form
{
[DllImport("Winmm.dll")]
private static extern int waveOutSetVolume(int hwo, System.UInt32 pdwVolume);//设置音量
[DllImport("Winmm.dll")]
private static extern uint waveOutGetVolume(int hwo,out System.UInt32 pdwVolume); //获取音量
public Form1()
{
InitializeComponent();

这个C#程序演示了如何通过调用Winmm.dll的waveOutSetVolume和waveOutGetVolume方法来控制和获取系统的音量。点击按钮可以获取当前音量并显示在滑块上,设置滑块的值则能改变系统音量。
最低0.47元/天 解锁文章
873

被折叠的 条评论
为什么被折叠?



