日期:2014-05-20  浏览次数:20727 次

为什么我这段代码不会发出声音呢?
C# code

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 radio
{
    public partial class Form1 : Form
    {
        [DllImport("kernel32.dll")]
        public static extern bool Beep(int frequency, int duration);   


        public Form1()
        {
            InitializeComponent();
        }

        private void button1_Click(object sender, EventArgs e)
        {
            int a = 500;
            int b = 700;
            Beep(a, b);  

        }

        


    }
}






求解!

------解决方案--------------------
不清,改动b值大一些,a也适当变化一下
------解决方案--------------------
你确定你的机器会叫。。。
------解决方案--------------------
System.Console.Beep(a,b)这样调用就可以了,
------解决方案--------------------
我的本可以叫 应该是机器设置问题