如题,请知道的朋友们不啬赐教。
:)

解决方案 »

  1.   

    The Beep function generates simple tones on the speaker. The function is synchronous; it does not return control to its caller until the sound finishes. BOOL Beep(
      DWORD dwFreq,      // sound frequency, in hertz
      DWORD dwDuration   // sound duration, in milliseconds
    );
     
    Parameters
    dwFreq 
    Windows NT: Specifies the frequency, in hertz, of the sound. This parameter must be in the range 37 through 32,767 (0x25 through 0x7FFF). 
    dwDuration 
    Windows NT: Specifies the duration, in milliseconds, of the sound. 
    Return Values
    If the function succeeds, the return value is nonzero.If the function fails, the return value is zero. To get extended error information, call GetLastError. 
      

  2.   

    microyzy(毛毛叉):
      好像还是不行啊!机箱的小喇叭不发声啊!
      (我有声卡,但我是想让机箱的小喇叭发声!)
      

  3.   

    这个在不同的操作系统下实现方法有些不同!封装成函数:Procedure Beep(nFreq,nDura: Word);
    Label
      Skip;
    var
      VerInfo: TOSVersionInfo;
      nStart: DWord;
    begin
      VerInfo.dwOSVersionInfoSize := SizeOf(VerInfo);
      GetVersionEx(VerInfo);
        if VerInfo.dwPlatformId = VER_PLATFORM_WIN32_NT then
          Windows.Beep(nFreq, nDura)
        else
        begin
          Asm
                push    bx
                in      al,     $61
                mov     bl,     al
                and     al,     3
                jne     Skip
                mov     al,     bl
                or      al,     3
                out     $61,    al
                mov     al,     $b6
                out     $43,    al
        Skip:   MOV     AX,     nFreq
                OUT     $42,    AL
                MOV     AL,     AH
                OUT     $42,    AL
                POP     BX
          end;
          nStart := GetTickCount;
          repeat
            Application.ProcessMessages;
          Until GetTickCount > nStart + nDura;
          asm
                IN      AL,     $61
                AND     AL,     $FC
                OUT     $61,    AL
          end;
        end;
    end;
      

  4.   

    将MessageBeep的uType参数设置为$FFFFFFFF。
      

  5.   

    若是Win2k或NT:Windows.Beep(200,200);
    若是Win9x或ME:
    Procedure Beep(nFreq,nDura: Word);
    Label
      Skip;
    var
      VerInfo: TOSVersionInfo;
      nStart: DWord;
    begin
      VerInfo.dwOSVersionInfoSize := SizeOf(VerInfo);
      GetVersionEx(VerInfo);
        if VerInfo.dwPlatformId = VER_PLATFORM_WIN32_NT then
          Windows.Beep(nFreq, nDura)
        else
        begin
          Asm
                push    bx
                in      al,     $61
                mov     bl,     al
                and     al,     3
                jne     Skip
                mov     al,     bl
                or      al,     3
                out     $61,    al
                mov     al,     $b6
                out     $43,    al
        Skip:   MOV     AX,     nFreq
                OUT     $42,    AL
                MOV     AL,     AH
                OUT     $42,    AL
                POP     BX
          end;
          nStart := GetTickCount;
          repeat
            Application.ProcessMessages;
          Until GetTickCount > nStart + nDura;
          asm
                IN      AL,     $61
                AND     AL,     $FC
                OUT     $61,    AL
          end;
        end;
    end;
      

  6.   

    哎呀,来晚了:(
    Windows.Beep(300,300);
    第一个参数是声音的频率,第二个参数是持续时间。
      

  7.   

    Var
      I : Integer;
    Begin
      For I:=100 To 150 Do Windows.Beep(I*10, 10);
      For I:=150 Downto 100 Do Windows.Beep(I*10, 10);
    End;