using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

using System.Runtime.InteropServices;

namespace Ex07_3
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }
        [DllImport("winmm.dll", EntryPoint = "waveOutGetNumDevs")]
        public static extern int waveOutGetNumDevs();
        private void button1_Click(object sender, EventArgs e)
        {
            if (waveOutGetNumDevs() != 0)
            {
                MessageBox.Show(this, "本计算机有声卡！", "信息提示", MessageBoxButtons.OK, MessageBoxIcon.Information); 
                Form2 myf = new Form2();
                myf.Show();
            }
            else
            {
                MessageBox.Show(this, "本计算机没有声卡！", "信息提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
        }
    }
}
