RSS订阅 | 匿名投稿
您的位置:网站首页 > 媒体 > 正文

delphi pc喇叭发声

作者:admin 来源:未知 日期:2010/5/8 11:46:29 人气: 标签:

Procedure pcBeep(nFreq,nDura: Word);         //pc喇叭发声
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;


procedure TForm1.Button1Click(Sender: TObject);
begin
pcBeep(300,3000);
end;


读完这篇文章后,您心情如何?
0
0
0
0
0
0
0
0
本文网址:
上一篇:ZnCRC.pas