怎样使主板扬声器发声?我试过messagebeep(0ffffffff)确还是从系统发出的声音,怎么办?
怎样调出本地连接TCP/IP属性窗口?就是能修改ip地址的窗口!或者相近的也行!我试过winexec('rundll32.exe shell32.dll,Control_RunDLL Netcpl.cpl',9);没反应,不知怎么回事!

解决方案 »

  1.   

    // 在WinX下让喇叭发声procedure BeepEx(const Freq: WORD = 1200; const Delay: WORD = 1);
    const
      FREQ_SCALE = $1193180;
    var
      Temp: WORD;
    begin
      Temp := FREQ_SCALE div Freq;
      asm
        in al,61h;
        or al,3;
        out 61h,al;
        mov al,$b6;
        out 43h,al;
        mov ax,temp;
        out 42h,al;
        mov al,ah;
        out 42h,al;
      end;
      Sleep(Delay);
      asm
        in al,$61;
        and al,$fc;
        out $61,al;
      end;
    end;
      

  2.   

    GoldShield(金盾)的方法试过了,在win2K下不行啊!ckc(火)的beep不行,早就试了啊!!大哥,还有没有其它的?
      

  3.   

    unit BleepInt; { Version 4.5 }{ Copyright 1999 Andy Preston - Apollo Developments, Swindon U.K. [email protected]  HACKERS OF THE WORLD UNITE!    HACKERS OF THE WORLD UNITE!    HACKERS OF THE WORLD UNITE!    HACKERS OF THE WORLD UNITE!  How to make your Delphi programs bleep like FRACTINT!  See Demo1.pas/Demo1.dfm or Bleepint.htm for details  This unit is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public
      License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.  This unit is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
      MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Library General Public License for more details.  You should have received a copy of the GNU Library General Public License along with this unit; if not, write to the
      Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
    }interfacetype
      TBleepType = (bOK, bInterrupt, bError);procedure ShutUp; { Added to help counter the effects of DoBleep (Freq, -1).
                        If you are producing a tone, & you want to stop without doing another Bleep, call this procedure }procedure DoBleep(Freq: Word; MSecs: LongInt); { Duration of -1 means bleep until the next bleep sent, or ShutUp is called }procedure Bleep(BleepType: TBleepType);implementationuses
    {$IFDEF WIN32}Windows{$ELSE}WinProcs{$ENDIF}
    {$IFNDEF CONSOLE}, Forms{$ENDIF};{ -- --- -- --- -- --- -- --- -- --- -- --- -- --- Assembler Bits for Wind 3.x And '95 -- --- -- --- -- --- -- --- -- --- }procedure AsmShutUp; {$IFDEF WIN32}pascal; {$ENDIF}begin
      asm
        In AL, $61
        And AL, $FC
        Out $61, AL
      end;
    end;procedure AsmBeep(Freq: Word); {$IFDEF WIN32}pascal; {$ENDIF}
    label
      Skip;
    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, Freq
            Out $42, AL
            Mov AL, AH
            Out $42, AL
            Pop BX
      end;
    end;{ -- --- -- --- -- --- -- --- -- --- -- --- -- --- Low Level Bits for Wind 3.x And '95 -- --- -- --- -- --- -- --- -- --- }procedure HardBleep(Freq: Word; MSecs: LongInt);
    const
      HiValue = {$IFDEF WIN32}High(DWord){$ELSE}High(LongInt){$ENDIF};
    var
      iCurrTickCount, iFirstTickCount: {$IFDEF WIN32}DWord{$ELSE}LongInt{$ENDIF};
      iElapTime: LongInt;
    begin
      if (Freq >= 20) and (Freq <= 5000) then begin
        AsmBeep(Word(1193181 div LongInt(Freq)));
        if MSecs >= 0 then begin
          iFirstTickCount := GetTickCount;
          repeat
    {$IFNDEF CONSOLE}
            if MSecs > 1000 then Application.ProcessMessages;
    {$ENDIF}
            iCurrTickCount := GetTickCount;
            { Has GetTickCount wrapped to 0 ? }
            if iCurrTickCount < iFirstTickCount then iElapTime := HiValue - iFirstTickCount + iCurrTickCount
            else iElapTime := iCurrTickCount - iFirstTickCount;
          until iElapTime >= MSecs;
          AsmShutUp;
        end;
      end;
    end;{ This is the old 'succumbs to Murphy's Law version of HardBleep              }
    { I'll delete it later - it's here just in case Murphy's Law hits the new one }
    { Why have I used (* *) style comments to hide it?                            }(* Procedure HardBleep (Freq : Word; MSecs : Integer);
       Var
        FirstTickCount : {$IFDEF WIN32} DWord {$ELSE} LongInt {$ENDIF};
       Begin
         If (Freq>=20) And (Freq<=5000) Then Begin
           AsmBeep (Word (1193181 Div LongInt(Freq)));
           If MSecs>-1 Then Begin
             FirstTickCount:=GetTickCount;
             Repeat
               {$IFNDEF CONSOLE} If MSecs>1000 Then Application.ProcessMessages; {$ENDIF}
             Until ((GetTickCount-FirstTickCount)>{$IFDEF WIN32} DWord {$ELSE} LongInt {$ENDIF}(MSecs));
             AsmShutUp;
           End;
         End;
       End; *){ -- --- -- --- -- --- -- --- -- --- -- --- -- --- -- --- Procedures for you to use -- --- -- --- -- --- -- --- -- --- -- --- }procedure Bleep(BleepType: TBleepType);
    begin
      case BleepType of
        bOK: begin
            DoBleep(1047, 100);
            DoBleep(1109, 100);
            DoBleep(1175, 100);
          end;
        bInterrupt: begin
            DoBleep(2093, 100);
            DoBleep(1976, 100);
            DoBleep(1857, 100);
          end;
        bError: DoBleep(40, 500);
      end;
    end;{$IFDEF WIN32}
    var
      SysWinNT: Boolean;
    {$ENDIF}procedure DoBleep(Freq: Word; MSecs: LongInt);
    begin
      if MSecs < -1 then MSecs := 0;
    {$IFDEF WIN32}if SysWinNT then Windows.Beep(Freq, MSecs) else {$ENDIF}HardBleep(Freq, MSecs);
    end;procedure ShutUp;
    begin
    {$IFDEF WIN32}if SysWinNT then Windows.Beep(1, 0) else {$ENDIF}AsmShutUp;
    end;{$IFDEF WIN32}procedure InitSysType;
    var
      VersionInfo: TOSVersionInfo;
    begin
      VersionInfo.dwOSVersionInfoSize := SizeOf(VersionInfo);
      GetVersionEx(VersionInfo);
      SysWinNt := VersionInfo.dwPlatformID = VER_PLATFORM_WIN32_NT;
    end;initialization
      InitSysType;{$ENDIF}end.
      

  4.   

    to  fei19790920(饭桶的马甲(抵制日货)) :请问怎么用啊?
      

  5.   

    各位大哥,没有那么复杂拉!在NT和2000下面要使PC喇叭发声,只要调用Windows.Beep(频率,延迟)就可以了。  
      

  6.   

    回复人: boorboor(粗人★★★★★) ( ) 信誉:100  2004-08-25 14:47:00  得分: 0  
     
     
       to  fei19790920(饭桶的马甲(抵制日货)) :请问怎么用啊?
      
     
    ************************DoBleep(100,1000);
      

  7.   

    1)Windows.Beep的API就可以了
    2) 用代码直接修改注册表的IP了,去Google去看看了rundll32.exe shell32.dll,Control_RunDLL NCPA.cpl只能打开网络链接
      

  8.   

    在安装声卡的机器里,beep不好用,要用到内嵌汇编完整的PC喇叭控制单元,支持NT系统和9X系统:  
     
    unit  BleepInt;  {  Version  4.5  }  
     
    {  Copyright  1999  Andy  Preston  -  Apollo  Developments,  Swindon  U.K.  [email protected]  
     
       HACKERS  OF  THE  WORLD  UNITE!        HACKERS  OF  THE  WORLD  UNITE!        HACKERS  OF  THE  WORLD  UNITE!        HACKERS  OF  THE  WORLD  UNITE!  
     
       How  to  make  your  Delphi  programs  bleep  like  FRACTINT!    See  Demo1.pas/Demo1.dfm  or  Bleepint.htm  for  details  
     
       This  unit  is  free  software;  you  can  redistribute  it  and/or  modify  it  under  the  terms  of  the  GNU  Library  General  Public  
       License  as  published  by  the  Free  Software  Foundation;  either  version  2  of  the  License,  or  (at  your  option)  any  later  version.  
     
       This  unit  is  distributed  in  the  hope  that  it  will  be  useful,  but  WITHOUT  ANY  WARRANTY;  without  even  the  implied  warranty  of  
       MERCHANTABILITY  or  FITNESS  FOR  A  PARTICULAR  PURPOSE.    See  the  GNU  Library  General  Public  License  for  more  details.  
     
       You  should  have  received  a  copy  of  the  GNU  Library  General  Public  License  along  with  this  unit;  if  not,  write  to  the  
       Free  Software  Foundation,  Inc.,  59  Temple  Place  -  Suite  330,  Boston,  MA    02111-1307,  USA.  
    }  
     
    interface  
     
    type  
       TBleepType  =  (bOK,  bInterrupt,  bError);  
     
    procedure  ShutUp;  {  Added  to  help  counter  the  effects  of  DoBleep  (Freq,  -1).  
                                           If  you  are  producing  a  tone,  &  you  want  to  stop  without  doing  another  Bleep,  call  this  procedure  }  
     
    procedure  DoBleep(Freq:  Word;  MSecs:  LongInt);  {  Duration  of  -1  means  bleep  until  the  next  bleep  sent,  or  ShutUp  is  called  }  
     
    procedure  Bleep(BleepType:  TBleepType);  
     
    implementation  
     
    uses  
    {$IFDEF  WIN32}Windows{$ELSE}WinProcs{$ENDIF}  
    {$IFNDEF  CONSOLE},  Forms{$ENDIF};  
     
    {  --  ---  --  ---  --  ---  --  ---  --  ---  --  ---  --  ---  Assembler  Bits  for  Wind  3.x  And  '95  --  ---  --  ---  --  ---  --  ---  --  ---  }  
     
    procedure  AsmShutUp;  {$IFDEF  WIN32}pascal;  {$ENDIF}  
     
    begin  
       asm  
           In  AL,  $61  
           And  AL,  $FC  
           Out  $61,  AL  
       end;  
    end;  
     
    procedure  AsmBeep(Freq:  Word);  {$IFDEF  WIN32}pascal;  {$ENDIF}  
    label  
       Skip;  
    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,  Freq  
                   Out  $42,  AL  
                   Mov  AL,  AH  
                   Out  $42,  AL  
                   Pop  BX  
       end;  
    end;  
     
    {  --  ---  --  ---  --  ---  --  ---  --  ---  --  ---  --  ---  Low  Level  Bits  for  Wind  3.x  And  '95  --  ---  --  ---  --  ---  --  ---  --  ---  }  
     
    procedure  HardBleep(Freq:  Word;  MSecs:  LongInt);  
    const  
       HiValue  =  {$IFDEF  WIN32}High(DWord){$ELSE}High(LongInt){$ENDIF};  
    var  
       iCurrTickCount,  iFirstTickCount:  {$IFDEF  WIN32}DWord{$ELSE}LongInt{$ENDIF};  
       iElapTime:  LongInt;  
    begin  
       if  (Freq    >=  20)  and  (Freq    <=  5000)  then  begin  
           AsmBeep(Word(1193181  div  LongInt(Freq)));  
           if  MSecs    >=  0  then  begin  
               iFirstTickCount  :=  GetTickCount;  
               repeat  
    {$IFNDEF  CONSOLE}  
                   if  MSecs    >  1000  then  Application.ProcessMessages;  
    {$ENDIF}  
                   iCurrTickCount  :=  GetTickCount;  
                   {  Has  GetTickCount  wrapped  to  0  ?  }  
                   if  iCurrTickCount    <  iFirstTickCount  then  iElapTime  :=  HiValue  -  iFirstTickCount  +  iCurrTickCount  
                   else  iElapTime  :=  iCurrTickCount  -  iFirstTickCount;  
               until  iElapTime    >=  MSecs;  
               AsmShutUp;  
           end;  
       end;  
    end;  
     
    {  This  is  the  old  'succumbs  to  Murphy's  Law  version  of  HardBleep                            }  
    {  I'll  delete  it  later  -  it's  here  just  in  case  Murphy's  Law  hits  the  new  one  }  
    {  Why  have  I  used  (*  *)  style  comments  to  hide  it?                                                        }  
     
    (*  Procedure  HardBleep  (Freq  :  Word;  MSecs  :  Integer);  
         Var  
           FirstTickCount  :  {$IFDEF  WIN32}  DWord  {$ELSE}  LongInt  {$ENDIF};  
         Begin  
             If  (Freq  >=20)  And  (Freq  <=5000)  Then  Begin  
                 AsmBeep  (Word  (1193181  Div  LongInt(Freq)));  
                 If  MSecs  >-1  Then  Begin  
                     FirstTickCount:=GetTickCount;  
                     Repeat  
                         {$IFNDEF  CONSOLE}  If  MSecs  >1000  Then  Application.ProcessMessages;  {$ENDIF}  
                     Until  ((GetTickCount-FirstTickCount)  >{$IFDEF  WIN32}  DWord  {$ELSE}  LongInt  {$ENDIF}(MSecs));  
                     AsmShutUp;  
                 End;  
             End;  
         End;  *)  
     
    {  --  ---  --  ---  --  ---  --  ---  --  ---  --  ---  --  ---  --  ---  Procedures  for  you  to  use  --  ---  --  ---  --  ---  --  ---  --  ---  --  ---  }  
     
    procedure  Bleep(BleepType:  TBleepType);  
    begin  
       case  BleepType  of  
           bOK:  begin  
                   DoBleep(1047,  100);  
                   DoBleep(1109,  100);  
                   DoBleep(1175,  100);  
               end;  
           bInterrupt:  begin  
                   DoBleep(2093,  100);  
                   DoBleep(1976,  100);  
                   DoBleep(1857,  100);  
               end;  
           bError:  DoBleep(40,  500);  
       end;  
    end;  
     
    {$IFDEF  WIN32}  
    var  
       SysWinNT:  Boolean;  
    {$ENDIF}  
     
    procedure  DoBleep(Freq:  Word;  MSecs:  LongInt);  
    begin  
       if  MSecs    <  -1  then  MSecs  :=  0;  
    {$IFDEF  WIN32}if  SysWinNT  then  Windows.Beep(Freq,  MSecs)  else  {$ENDIF}HardBleep(Freq,  MSecs);  
    end;  
     
    procedure  ShutUp;  
    begin  
    {$IFDEF  WIN32}if  SysWinNT  then  Windows.Beep(1,  0)  else  {$ENDIF}AsmShutUp;  
    end;  
     
    {$IFDEF  WIN32}  
     
    procedure  InitSysType;  
    var  
       VersionInfo:  TOSVersionInfo;  
    begin  
       VersionInfo.dwOSVersionInfoSize  :=  SizeOf(VersionInfo);  
       GetVersionEx(VersionInfo);  
       SysWinNt  :=  VersionInfo.dwPlatformID  =  VER_PLATFORM_WIN32_NT;  
    end;  
     
    initialization  
       InitSysType;  
     
    {$ENDIF}  
     
    end.  
     
      

  9.   


    调用过程:  
    Procedure  Beep(Seconds:  word);  
    Begin  
       Case  seconds  Of  
           50..59:  
               DoBleep(1500,  200);  
           0:  
               DoBleep(2100,  500);  
           1:  
               Begin  
                   DoBleep(2000,  200);  
                   Sleep(100);  
                   DoBleep(2000,  100);  
                   Sleep(100);  
                   DoBleep(2000,  100);  
                   Sleep(300);  
               End;  
           2:  
               Begin  
                   DoBleep(1000,  100);  
                   Sleep(100);  
                   DoBleep(2000,  100);  
                   Sleep(100);  
                   DoBleep(1000,  100);  
               End;  
           3:  
               Begin  
                   DoBleep(2093,  100);  
                   Sleep(100);  
                   DoBleep(1976,  100);  
                   Sleep(100);  
                   DoBleep(1857,  100);  
                   Sleep(100);  
                   DoBleep(2093,  200);  
               End;  
           4:  
               Begin  
                   DoBleep(2093,  100);  
                   //                Sleep(100);  
                   DoBleep(1976,  100);  
                   //                Sleep(100);  
                   DoBleep(1857,  100);  
                   //                Sleep(100);  
                   DoBleep(1857,  100);  
               End;  
     
       End;  
    End;  
    5.0版本 Unit Bleeper; { Bleeper / BleepInt / GWBleep Version 5.0 }{ Copyright 1999 Andy Preston - Apollo Developments, Swindon U.K. [email protected] OF THE WORLD UNITE! HACKERS OF THE WORLD UNITE! HACKERS OF THE WORLD UNITE! HACKERS OF THE WORLD UNITE!Control of the PC speaker, the bleeper unit, see bleepint.htm for detailsThis unit is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public
    License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.This unit is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public License for more details.You should have received a copy of the GNU Library General Public License along with this unit; if not, write to the
    Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
    }InterfaceProcedure ShutUp; { Added to help counter the effects of DoBleep (Freq, -1).
    If you are producing a tone, & you want to stop without doing another Bleep, call this procedure }Procedure DoBleep (Freq : Word; MSecs : LongInt); { Duration of -1 means bleep until the next bleep sent, or ShutUp is called }ImplementationUses
    {$IFDEF WIN32}Windows{$ELSE}WinProcs{$ENDIF}
    {$IFNDEF CONSOLE}, Forms{$ENDIF};{ -- --- -- --- -- --- -- --- -- --- -- --- -- --- Assembler Bits for Wind 3.x And '95 -- --- -- --- -- --- -- --- -- --- }Procedure AsmShutUp;
    {$IFDEF WIN32}Pascal;
    {$ENDIF}
    Begin
    Asm
    In AL, $61
    And AL, $FC
    Out $61, AL
    End;
    End;Procedure AsmBeep (Freq : Word);
    {$IFDEF WIN32}Pascal;
    {$ENDIF}
    Label
    Skip;
    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, Freq
    Out $42, AL
    Mov AL, AH
    Out $42, AL
    Pop BX
    End;
    End;{ -- --- -- --- -- --- -- --- -- --- -- --- -- --- Low Level Bits for Wind 3.x And '95 -- --- -- --- -- --- -- --- -- --- }Procedure HardBleep (Freq : Word; MSecs : LongInt);
    Const
    HiValue={$IFDEF WIN32}High (DWord){$ELSE}High (LongInt){$ENDIF};
    Var
    iCurrTickCount, iFirstTickCount : {$IFDEF WIN32}DWord{$ELSE}LongInt{$ENDIF};
    iElapTime : LongInt;
    Begin
    If (Freq>=20)And (Freq<=5000)Then Begin
    AsmBeep (Word (1193181 Div LongInt (Freq)));
    If MSecs>=0 Then Begin
    iFirstTickCount:=GetTickCount;
    Repeat
    {$IFNDEF CONSOLE}
    If MSecs>1000 Then Application.ProcessMessages;
    {$ENDIF}
    iCurrTickCount:=GetTickCount;
    { Has GetTickCount wrapped to 0 ? }
    If iCurrTickCount<iFirstTickCount Then iElapTime:=HiValue-iFirstTickCount+iCurrTickCount
    Else iElapTime:=iCurrTickCount-iFirstTickCount;
    Until iElapTime>=MSecs;
    AsmShutUp;
    End;
    End;
    End;{ This is the old 'succumbs to Murphy's Law version of HardBleep }
    { I'll delete it later - it's here just in case Murphy's Law hits the new one }
    { Why have I used (* *) style comments to hide it? }(* Procedure HardBleep (Freq : Word; MSecs : Integer);
    Var
    FirstTickCount : {$IFDEF WIN32} DWord {$ELSE} LongInt {$ENDIF};
    Begin
    If (Freq>=20) And (Freq<=5000) Then Begin
    AsmBeep (Word (1193181 Div LongInt(Freq)));
    If MSecs>-1 Then Begin
    FirstTickCount:=GetTickCount;
    Repeat
    {$IFNDEF CONSOLE} If MSecs>1000 Then Application.ProcessMessages; {$ENDIF}
    Until ((GetTickCount-FirstTickCount)>{$IFDEF WIN32} DWord {$ELSE} LongInt {$ENDIF}(MSecs));
    AsmShutUp;
    End;
    End;
    End; *){ -- --- -- --- -- --- -- --- -- --- -- --- -- --- -- --- Procedures for you to use -- --- -- --- -- --- -- --- -- --- -- --- }{$IFDEF WIN32}
    Var
    SysWinNT : Boolean;
    {$ENDIF}Procedure DoBleep (Freq : Word; MSecs : LongInt);
    Begin
    If MSecs<-1 Then MSecs:=0;
    {$IFDEF WIN32}If SysWinNT Then Windows.Beep (Freq, MSecs)Else{$ENDIF}HardBleep (Freq, MSecs);
    End;Procedure ShutUp;
    Begin
    {$IFDEF WIN32}If SysWinNT Then Windows.Beep (1, 0)Else{$ENDIF}AsmShutUp;
    End;{$IFDEF WIN32}Procedure InitSysType;
    Var
    VersionInfo : TOSVersionInfo;
    Begin
    VersionInfo.dwOSVersionInfoSize:=SizeOf (VersionInfo);
    GetVersionEx (VersionInfo);
    SysWinNt:=VersionInfo.dwPlatformID=VER_PLATFORM_WIN32_NT;
    End;Initialization
    InitSysType;{$ENDIF}End.
      

  10.   

    官方说明:Bleeper / BleepInt / GWBleep
    Version 5.2
    Control of PC Speaker in Delphi.
    Make your programs bleep like FractInt.
    Play tunes in the style of GWBasic's Play Statement.Copyleft Andy Preston, Apollo Developments, 1999.For more details, check out Andy's AnorakLicensing
    This is Free Software, released under the LGPL (Copy Enclosed).
    OSI Certified Open Source Software.Platforms
    Delphi 1, 2, 3, and 4; C++ Builder 1, 3, and 4.Use
    C++ Builder Note
    You must create your own bleeper.hpp, bleepint.hpp, and gwbleep.hpp file; to do this, load and compile the demo program. If you are updating a previous version of BleepInt, delete your old bleepint.hpp file first.Speaker Control
    First, copy Bleeper.pas to your library directory.You can use DoBleep, BleepPause, and ShutUp thus:In Delphi:    Implementation   Uses
         Bleeper;   Procedure HurtMe;     { Play a nasty high pitched note }
       Begin                 { Don't stop until you're told to }
         DoBleep (1000, -1);
       End;   Procedure MakeItStop; { Stop whatever sound is being produced }
       Begin
         ShutUp;
       End;   Procedure PlayTune;   { Play some nice tones of set duration }
       Begin                 { The people of Earth call it music. }
         DoBleep (146, 250);
         BleepPause (10);
         DoBleep (123, 250);
         BleepPause (10);
         DoBleep (164, 500);
         BleepPause (10);
         DoBleep (123, 500);
       End; In C++Builder    #include <mylib/bleeper.hpp>   void HurtMe {         // Play a nasty high pitched note
         DoBleep (1000, -1); // Don't stop until you're told to
       }   void MakeItStop {  // Stop whatever sound is being produced
         ShutUp;
       }   void PlayTune {       // Play some nice tones of set duration
         DoBleep (146, 250); // The people of Earth call it music.
         BleepPause (10);
         DoBleep (123, 250);
         BleepPause (10);
         DoBleep (164, 500);
         BleepPause (10);
         DoBleep (123, 500);
       } Warning - Compatability with earlier versions
    The specification of DoBleep (until version 4.5) was: Procedure DoBleep (Freq : Word; MSecs : Integer);
    As of version 4.5 it is: 
    Procedure DoBleep (Freq : Word; MSecs : LongInt);
    This will only affect your 16-bit code (in 32-bit code an Integer is the same as a LongInt), and I don't think it will make a lot of difference to that either, but you have been warned. 
     Fractint Bleeps
    First, copy Bleeper.pas and BleepInt.pas to your library directory.You can use Bleep thus: In Delphi:    Implementation   Uses
         BleepInt;   Procedure FractintBeeps;
       Begin 
         Bleep (bOK);
         Bleep (bInterrupt);
         Bleep (bError);
       End; In C++ Builder:    #include <mylib/bleepint.hpp>   void FractintBeeps {
         Bleep (bOK);
         Bleep (bInterrupt);
         Bleep (bError);
       } Playing tunes
    First, copy Bleeper.pas and GWBleep.pas to your library directory.You can use Play thus: In Delphi:    Implementation   Uses
         GWBleep;   Procedure PlayAScale;
       Begin
         PlayBleep ('L4<BPCPC+PDPD+PEPFPF+PGPG+PAPB-PBP>C');
       End;   Procedure PlayATune;
       Begin
         PlayBleep ('L2D4<B4E<BP8C#8D4<B4E<BP8C#DGF#GEL4D<BEE<B1')
    ;
       End;In C++ Builder:    #include <mylib/gwbleep.hpp>   void PlayAScale {
         PlayBleep ('L4<BCC+DD+EFF+GG+AB-B>C');
       }   void PlayATune {
         PlayBleep ('L2D4<B4E<BP8C#8D4<B4E<BP8C#DGF#GEL4D<BEE<B1')
    ;
       } The command strings used by PlayBleep are a subset of those used by the old GWBasic Play statement.The commands implemented so far are:P,A,B,C,D,E,F,G [#,+,-] A-G are the notes, a # or + after a note makes it sharp, a - after a note makes it flat.
    P is special, it does not sound a note, it is for inserting pauses into the tune. 
    Ln Sets the length of the notes, L4 is a quarter note, L1 is a whole note
    To set the duration of one note, you can put the duration after that note, as in the PlayATune example above 
    On Sets the octave in the range 1..7. The default octave is 4. Middle C is at the beginning of octave 3 
    > Plays the next note only, one octave higher 
    < Plays the next note only, one octave lower 
    See Demo.dpr, Demo1.dfm, And Demo1.pas (included in this archive) for more information.or for the C++Builder fans, see CBDemo.mak, CBDemo.cpp, CBDemo1.dfm, CBDemo1.cpp, And CBDemo1.hIf there's a C++Builder dude out there who can remove all references to CDDemo.res from CBDemo.mak, please E-Mail me (Andy Preston) so I can include your modified versionThe Story
    My customer needed a set of warning bleeps in his application, he didn't have a sound card (not much use in a kitchen!), and Windows' built-in (and rathe r sad) dit was no use at all.I got hold of the TPCSpeaker component by Song Weng Sam from The DSP. But I thought a simple beeper was best implemented as a set of stand-alone procedures.I was in the process of hacking TPCSpeaker into such a set of routines when I came across an ancient copy of the FractInt source (Version 7.0 I think) which contained assembly source for the classic FractInt 'do-do-doop'.
    Why not give my customer a bleep with real class!
     So what we started with was a mixture of Song Weng Sam's delay loop, and a rather cut down version of FractInt's sound routines.Since that time, many of you have added new facilities, and fixed bugs in BleepInt. The result is the only speaker driver you'll ever need.If you've got any fab-and-groovy modifications for Bleepint, please E-Mail me (Andy Preston).Thanks
    FractInt, still the ultimate fractal generator, is a product of the Stone-Soup Group. I'm not sure which particular Stone-Souper was responsible for the bits I 've filched, so I can't give hir the credit sHe deserves, I'll just take my hat off (except I don't wear a hat) to the lot of them.Thanks to:Thomas Roettgers for further Delphi 3 Testing and Compatability improvements, Windows NT Support, and NT Parameter compatability [DoBleep (Freq, -1)] 
    Basri & Don Adaway for pointing out bugs in the NT code 
    P.Satyanarayana of VJIL Consulting India for spotting a warning message, when used with Delphi 4 
    Michl Ladislav for suggestions to shrink the size of 32-bit Console Apps, saving 130K, and spotting the minor bug in HardBleep. 
    Roy Andrews, CS-Interglas Ltd, for pointing out the range check bug in Windows NT. 
    Uffe R. L. Stentebjerg, for getting me to work out a proper C++ Builder demo, and instructions. 
    Jack Stiles of SwiftTech Software, for finally, getting rid of P. Satyanarayana's warning message, and for eliminating a rare bug in the delay loop: If the machine has been up-and-running for 49.7 days, the clock resets to zero (It's a bit like a mini-'millenium bug'), Jack's new code 'notices' this has happened and deals with it accordingly. Thanks also goes to Jack for helping to convert the table of frequencies into a useful format 
    Testing
    If you've tested it with Delphi 3, Delphi 4, C++ Builder, or on NT, please E-Mail me (Andy Preston) and let me know. Then I can update this.Version 5.2 Tested by Apollo Developments on Delphi 1.02 and 2.0 
    Version 4.5 Tested by Jack Stiles of SwiftTech Software on Delphi 4.0 
    Version 4.1 Tested by Alan with Delphi 2.0 / NT 4 (SP 3) --------------------------------------------------------------------------------
    This page has been checked by Weblint, Version 1.020
     OSI Certified is a certification  of the Open Source Initiative. Delphi and C++Builder are trades of Inprise International, GWBasic is a trade of Microsoft corp. 
      

  11.   

    发声已经搞定,用了extcsdn(Studing VB now)和ly_liuyang(Liu Yang)的Windows.Beep(频率,延迟),现在就剩第2个问题了啊!实在不行就用ly_liuyang的算了啊!若第二个问题有更好的答案,我愿再出100分!!明天下午结帖,望各位大哥多关照啊!!