如何让主板上的蜂鸣器蜂鸣?试过使用kernel32里的Beep函数时扬声器发出了蜂鸣声,而且有延迟、音长不准、有停顿等问题。又试过让设备管理器非即插即用设备的Beep停用,可是我点了停用就卡死了。(Windows 7 x64)
我又在xp上试了试,停用了重启运行同一个程序,Beep函数直接跳过了。(两台电脑主板上肯定有蜂鸣器)又看见用WinIO做,但是不会。
请大家给个代码,最好是C#的……

解决方案 »

  1.   

    求助啊求助,求助啊求助。
    找到个wince的beep:http://stackoverflow.com/questions/7917805/how-to-create-a-dll-that-will-be-used-in-c-sharp
    是C++的。另外又找到了这段程序,但是不能正常运行。(0x01281e45 处有未经处理的异常: 0xC0000096: Privileged instruction)
    代码如下:#include "stdafx.h"
    #include <iostream>
    #include <windows.h>
    #include <conio.h>
    using namespace std;int _tmain(int argc, _TCHAR* argv[])
    {
    outp(0x43,0xb6);
    outp(0x42,0x33);
    outp(0x42,0x5);
    int xx=inp(0x61);
    outp(0x61,xx|3);
    Sleep(10);
    outp(0x61,xx);
    return 0;
    }
      

  2.   

    这个是C语言的,如果有人能弄成C++的也行,C#最好:http://gd.tuwien.ac.at/languages/c/programming-bbrown/advcw3.htm#sound
    求助啊求助