感谢您使用微软产品。首先,您需要添加Microsoft Visual Basic .NET Runtime(Microsoft.VisualBasic.dll),方法如下:
Project->Add Reference->.NET->Microsoft Visual Basic .NET Runtime
然后只要在需要蜂鸣的地方调用:
Microsoft.VisualBasic.Interaction.Beep();希望能对您有所帮助!======================
- 微软全球技术中心本贴子仅供CSDN的用户作为参考信息使用。其内容不具备任何法律保障。您需要考虑到并承担使用此信息可能带来的风险。具体事项可参见使用条款(http://support.microsoft.com/directory/worldwide/zh-cn/community/terms_chs.asp)。
为了为您创建更好的讨论环境,请参加我们的用户满意度调查(http://support.microsoft.com/directory/worldwide/zh-cn/community/survey.asp?key=(S,49854782))。
======================
Project->Add Reference->.NET->Microsoft Visual Basic .NET Runtime
然后只要在需要蜂鸣的地方调用:
Microsoft.VisualBasic.Interaction.Beep();希望能对您有所帮助!======================
- 微软全球技术中心本贴子仅供CSDN的用户作为参考信息使用。其内容不具备任何法律保障。您需要考虑到并承担使用此信息可能带来的风险。具体事项可参见使用条款(http://support.microsoft.com/directory/worldwide/zh-cn/community/terms_chs.asp)。
为了为您创建更好的讨论环境,请参加我们的用户满意度调查(http://support.microsoft.com/directory/worldwide/zh-cn/community/survey.asp?key=(S,49854782))。
======================
/// 参数是频率,后面参数是时值
/// </summary>
[DllImport("kernel32.dll")]
private static extern int Beep(int dwFreq ,int dwDuration) ;
向微软的那位大侠一样一句例子就可以了。(毕竟我不知道参数啊)
再次感谢了
以下是调用API的例子代码:
using System.Runtime.InteropServices;在类的声明后面加上:
[DllImport("user32.dll")]
public static extern int MessageBeep(int beep);
然后在您需要的地方调用MessageBeep函数:
private void button1_Click(object sender, System.EventArgs e)
{
MessageBeep(0x0);
}希望对您有所帮助!======================
- 微软全球技术中心本贴子仅供CSDN的用户作为参考信息使用。其内容不具备任何法律保障。您需要考虑到并承担使用此信息可能带来的风险。具体事项可参见使用条款(http://support.microsoft.com/directory/worldwide/zh-cn/community/terms_chs.asp)。
为了为您创建更好的讨论环境,请参加我们的用户满意度调查(http://support.microsoft.com/directory/worldwide/zh-cn/community/survey.asp?key=(S,49854782))。
======================
private static extern int Beep(int dwFreq ,int dwDuration) ;
[STAThread]
static void Main()
{
Application.Run(new Form1());
} private void button1_Click(object sender, System.EventArgs e)
{
int a=1222;
int b=1000;
Beep(a,b);
}
记得引用名字空间using System.Runtime .InteropServices;
private static extern int Beep(int dwFreq ,int dwDuration) ;
[STAThread]
static void Main()
{
Application.Run(new Form1());
} private void button1_Click(object sender, System.EventArgs e)
{
int a=1222;
int b=1000;
Beep(a,b);
}
记得引用名字空间using System.Runtime .InteropServices;
private static extern int Beep(int dwFreq ,int dwDuration) ;private void button1_Click(object sender, System.EventArgs e)
{
int a=0X7FF;
int b=1000;
Beep(a,b);
}
引用:using System.Runtime .InteropServices;
贴了N次都贴都不是:(((((((