全國最多中醫師線上諮詢網站-台灣中醫網
發文 回覆 瀏覽次數:5891
推到 Plurk!
推到 Facebook!

區域網路..語音網路電話(繁體化版)

 
flyup
資深會員


發表:280
回覆:508
積分:385
註冊:2002-04-15

發送簡訊給我
#1 引用回覆 回覆 發表時間:2003-02-09 01:05:30 IP:218.163.xxx.xxx 未訂閱
區域網路..語音網路電話(繁體化版)    使用方式: 1.一般電腦麥克風即可使用 2.鍵入對方IP後,按滑鼠右鍵使用快速選單:呼叫或掛機(等候別人呼叫) 3.關機:關閉程式 4.有人呼叫你記得按接聽 發表人 - flyup 於 2003/02/09 12:52:42
附加檔案:25671_NetPhone.zip
flyup
資深會員


發表:280
回覆:508
積分:385
註冊:2002-04-15

發送簡訊給我
#2 引用回覆 回覆 發表時間:2003-02-09 01:42:16 IP:218.163.xxx.xxx 未訂閱
區域網路..語音..傳輸最佳! 遠端方式...效果不是粉好!    
jackkcg
站務副站長


發表:891
回覆:1050
積分:848
註冊:2002-03-23

發送簡訊給我
#3 引用回覆 回覆 發表時間:2003-02-09 01:51:30 IP:61.64.xxx.xxx 未訂閱
flyup 神偷 的精神令人敬佩 ********************************************************* 哈哈&兵燹 最會的2大絕招 這個不會與那個也不會 哈哈哈 粉好 Delphi K.Top的K.Top分兩個字解釋Top代表尖端的意思,希望本討論區能提供Delphi的尖端新知 K.表Knowlege 知識,就是本站的標語:Open our mind to make knowledge together! 希望能大家敞開心胸,將知識寶庫結合一起
------
**********************************************************
哈哈&兵燹
最會的2大絕招 這個不會與那個也不會 哈哈哈 粉好

Delphi K.Top的K.Top分兩個字解釋Top代表尖端的意思,希望本討論區能提供Delphi的尖端新知
K.表Knowlege 知識,就是本站的標語:Open our mind
cmf
尊榮會員


發表:84
回覆:918
積分:1032
註冊:2002-06-26

發送簡訊給我
#4 引用回覆 回覆 發表時間:2003-02-09 12:36:40 IP:61.70.xxx.xxx 未訂閱
f sir:        請問 NET PHONE 如何使用?        須要那些硬體配合     發表人 - cmf 於 2003/02/09 12:37:51
------
︿︿
flyup
資深會員


發表:280
回覆:508
積分:385
註冊:2002-04-15

發送簡訊給我
#5 引用回覆 回覆 發表時間:2003-02-09 12:41:47 IP:61.225.xxx.xxx 未訂閱
1.一般電腦麥克風即可使用 2.鍵入對方IP後,按滑鼠右鍵使用快速選單:呼叫或掛機(等候別人呼叫) 3.關機:關閉程式 4.有人呼叫你記得按接聽 發表人 - flyup 於 2003/02/09 12:53:08
Jasonwong
版主


發表:49
回覆:931
積分:581
註冊:2006-10-27

發送簡訊給我
#6 引用回覆 回覆 發表時間:2003-02-09 14:36:07 IP:61.70.xxx.xxx 未訂閱
經我跟 SANWIN 在 INTERNET 上測試結果~ 傳輸地點:台北~高雄 傳輸條件:T1 對 T1 結論:效果也不錯啊,音質也很好哦,速度也沒有DELAY的樣子。 -- 聰明的人,喜歡猜心;雖然每次都猜對了,卻失去了自己的心 傻氣的人,喜歡給心;雖然每次都被笑了,卻得到了別人的心
------
聰明的人,喜歡猜心;雖然每次都猜對了,卻失去了自己的心
傻氣的人,喜歡給心;雖然每次都被笑了,卻得到了別人的心
flyup
資深會員


發表:280
回覆:508
積分:385
註冊:2002-04-15

發送簡訊給我
#7 引用回覆 回覆 發表時間:2003-02-09 14:41:13 IP:61.225.xxx.xxx 未訂閱
ASDL 512k/64k bps 傳輸不是粉好ㄝ    
ry_lee
高階會員


發表:368
回覆:251
積分:123
註冊:2002-03-19

發送簡訊給我
#8 引用回覆 回覆 發表時間:2003-02-17 20:32:30 IP:61.59.xxx.xxx 未訂閱
引言: 區域網路..語音網路電話(繁體化版) 使用方式: 1.一般電腦麥克風即可使用 2.鍵入對方IP後,按滑鼠右鍵使用快速選單:呼叫或掛機(等候別人呼叫) 3.關機:關閉程式 4.有人呼叫你記得按接聽 發表人 - flyup 於 2003/02/09 12:52:42
flyup Sir: 1.你開發之程式在使用時,呼叫端及受話端中間是否須中介應用程式伺服器? 2.除語音外可否傳影像? 3.你是否以封裝tapi 3.0之元件去撰寫程式?
flyup
資深會員


發表:280
回覆:508
積分:385
註冊:2002-04-15

發送簡訊給我
#9 引用回覆 回覆 發表時間:2003-02-17 23:04:09 IP:61.216.xxx.xxx 未訂閱
    flyup Sir: 1.你開發之程式在使用時,呼叫端及受話端中間是否須中介應用程式伺服器? 不用 2.除語音外可否傳影像? 暫不考慮! 3.你是否以封裝tapi 3.0之元件去撰寫程式? 否!
qoo1234
版主


發表:256
回覆:1167
積分:659
註冊:2003-02-24

發送簡訊給我
#10 引用回覆 回覆 發表時間:2003-04-24 23:45:43 IP:61.217.xxx.xxx 未訂閱
希望高手們,能把他改成這樣子~~ ftp://211.100.8.153/download/10/17104_NetPhone.zip 發表是最好的記憶! 發表人 - qoo1234 於 2003/04/25 00:32:20
qoo1234
版主


發表:256
回覆:1167
積分:659
註冊:2003-02-24

發送簡訊給我
#11 引用回覆 回覆 發表時間:2003-04-25 00:38:19 IP:61.217.xxx.xxx 未訂閱
如上,因為設計者..就是用這個原始碼寫的~~ < src="http://simg3.pchome.com.tw/simage/thumbnail/3628/home.kimo.com.tw£¯angelbeach2002£¯qoo£¯angel_qoo.gif">發表是最好的記憶!
GGL
資深會員


發表:104
回覆:600
積分:335
註冊:2006-11-05

發送簡訊給我
#12 引用回覆 回覆 發表時間:2003-06-29 13:26:45 IP:211.76.xxx.xxx 未訂閱
請問一下... 我想把它改成BCB的版本,但是我對Delphi不熟,在type裡面有 TActiveMsg=(MsgAttempTalk,MsgAcceptTalk); PassiveMsg=(MsgTalkAvialable,MsgPhoneBusy); TPhoneState=(StateFree,StateBusy,StateCalling,StateBeCalled,StateTalking); 請問這3行如何改成BCB,這段程式碼我看不懂... 還有在宣告方面: pWaveHdr1,pWaveHdr2:PWAVEHDR; waveformIn:TWAVEFORMATEX; hWaveIn:HWAVEIN; PWAVEHDR、TWAVEFORMATEX、HWAVEIN應該改成什麼? 謝謝...
Wawa
一般會員


發表:27
回覆:55
積分:16
註冊:2002-10-04

發送簡訊給我
#13 引用回覆 回覆 發表時間:2003-08-29 18:49:04 IP:61.224.xxx.xxx 未訂閱
請教為什麼我在區域網路使用得很好,音質也很好. 但透過 Internet , 呼叫卻通不了. 錯誤為 您撥叫的用戶沒有開機(nophone.wav) 不知為何,能否告知. 謝謝!!
tamad
一般會員


發表:2
回覆:3
積分:1
註冊:2004-06-02

發送簡訊給我
#14 引用回覆 回覆 發表時間:2004-10-17 03:25:35 IP:218.165.xxx.xxx 未訂閱
我也正好想要學習網路電話的程式寫法, 若有那位厲害的大大請教學用c builder 來寫這個程式!感激不盡啊…
diave
一般會員


發表:0
回覆:2
積分:0
註冊:2004-12-04

發送簡訊給我
#15 引用回覆 回覆 發表時間:2004-12-04 20:45:35 IP:220.133.xxx.xxx 未訂閱
感謝分享 謝謝
cmf
尊榮會員


發表:84
回覆:918
積分:1032
註冊:2002-06-26

發送簡訊給我
#16 引用回覆 回覆 發表時間:2004-12-09 13:32:50 IP:61.218.xxx.xxx 未訂閱
請參考這篇 仿FLYUP N/A 之 PCHOME P2P VOIP 語音網路電話(BCB版) http://delphi.ktop.com.tw/topic.php?TOPIC_ID=61195    
引言: 我也正好想要學習網路電話的程式寫法, 若有那位厲害的大大請教學用c builder 來寫這個程式!感激不盡啊…
http://netbook.mm520.net
------
︿︿
anderson0805
一般會員


發表:3
回覆:4
積分:1
註冊:2004-10-27

發送簡訊給我
#17 引用回覆 回覆 發表時間:2005-05-03 10:05:51 IP:203.68.xxx.xxx 未訂閱
各位先進您們好: 由於小弟在學習BCB6.0想把這個網路電話改成BCB版本,可是改著改著,還是有很多錯誤,希望在此的每位大哥幫幫忙,幫忙修改一下,我弄了很久,請多指教,謝謝!    
unit Main;    interface    uses
  Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
  StdCtrls, ScktComp, ComCtrls,mmsystem, Buttons, jpeg, ExtCtrls, Mask,
  Menus;    type
  TActiveMsg=(MsgAttempTalk,MsgAcceptTalk);
  TPassiveMsg=(MsgTalkAvialable,MsgPhoneBusy);
  TPhoneState=(StateFree,StateBusy,StateCalling,StateBeCalled,StateTalking);
  TPhoneForm = class(TForm)
    MsgClientSocket: TClientSocket;
    MsgServerSocket: TServerSocket;
    StatusBar: TStatusBar;
    DataClientSocket: TClientSocket;
    DataServerSocket: TServerSocket;
    ConnectBtn: TBitBtn;
    AcceptBtn: TBitBtn;
    HangUpBtn: TBitBtn;
    Image1: TImage;
    Image2: TImage;
    MaskEdit: TMaskEdit;
    Label1: TLabel;
    PopupMenu1: TPopupMenu;
    N1: TMenuItem;
    N2: TMenuItem;
    N3: TMenuItem;
    N4: TMenuItem;
    procedure ConnectBtnClick(Sender: TObject);
    procedure FormCreate(Sender: TObject);
    procedure MsgClientSocketConnect(Sender: TObject;
      Socket: TCustomWinSocket);
    procedure MsgServerSocketClientRead(Sender: TObject;
      Socket: TCustomWinSocket);
    procedure MsgClientSocketRead(Sender: TObject;
      Socket: TCustomWinSocket);
    procedure AcceptBtnClick(Sender: TObject);
    procedure HangUpBtnClick(Sender: TObject);
    procedure DataServerSocketClientDisconnect(Sender: TObject;
      Socket: TCustomWinSocket);
    procedure MsgServerSocketClientDisconnect(Sender: TObject;
      Socket: TCustomWinSocket);
    procedure FormDestroy(Sender: TObject);
    procedure DataServerSocketClientConnect(Sender: TObject;
      Socket: TCustomWinSocket);
    procedure DataServerSocketClientRead(Sender: TObject;
      Socket: TCustomWinSocket);
    procedure DataClientSocketConnect(Sender: TObject;
      Socket: TCustomWinSocket);
    procedure MsgClientSocketError(Sender: TObject;
      Socket: TCustomWinSocket; ErrorEvent: TErrorEvent;
      var ErrorCode: Integer);
    procedure MsgClientSocketLookup(Sender: TObject;
      Socket: TCustomWinSocket);
    procedure Image1MouseDown(Sender: TObject; Button: TMouseButton;
      Shift: TShiftState; X, Y: Integer);
    procedure Image1MouseUp(Sender: TObject; Button: TMouseButton;
      Shift: TShiftState; X, Y: Integer);
    procedure Image1MouseMove(Sender: TObject; Shift: TShiftState; X,
      Y: Integer);
    procedure N4Click(Sender: TObject);
    procedure PopupMenu1Popup(Sender: TObject);
  private
    { Private declarations }
    char MsgText[1];
    PWAVEHDR pWaveHdr1,pWaveHdr2;
    TWAVEFORMATEX waveformIn;
    HWAVEIN hWaveIn;
    char pBuffer1[BUF_SIZE-1],pBuffer2[BUF_SIZE-1];
    boolean bEndRecord,bEndPlay,bFirstReceive,NoDataInBuf;
    HWAVEOUT hWaveOut;
    PWAVEHDR pWaveHdrs[BUF_NUM-1];
    Pointer Memos[UF_NUM-1];
    int CurMemoIndex;
    int CurPlayMemo;
    char ReciBuf[BUF_SIZE-1];
    TWAVEFORMATEX waveformOut;
    int NeedPlayBufCount; //待播放的內存塊的數量
    procedure mmwimopen(var Msg: TMessage); message MM_WIM_OPEN;
    procedure mmwimdata(var Msg: TMessage); message MM_WIM_DATA;
    procedure mmwimclose(Var Msg:TMessage);message MM_WIM_CLOSE;
    procedure mmwomopen(Var Msg:TMessage);message MM_WOM_OPEN;
    procedure mmwomdone(Var Msg:TMessage);message MM_WOM_DONE;
    procedure mmwomclose(Var Msg:TMessage);message MM_WOM_CLOSE;
    void __fastcall TForm1::PlayNotify(int model);//發出提示音
    void __fastcall TForm1::StopNotify();//停止提示
    void __fastcall TForm1::SendActiveMsg(TActiveMsg ActiveMsg);//發送一個遠程消息
    void __fastcall TForm1::FeedbackPassiveMsg(TPassiveMsg PassiveMsg,TCustomWinSocket Socket);
  public
    { Public declarations }
    TPhoneState LocalState;
    void __fastcall TForm1::StartSendSound();
    void __fastcall TForm1::EndSendSound();
    void __fastcall TForm1::StartPlaySound();
    void __fastcall TForm1::EndPlaySound();
  end;    var
  PhoneForm: TPhoneForm;    implementation
uses RemoAddrDlg;    {$R *.DFM}
//點擊呼叫按紐
const int BUF_SIZE=4000;
const int BUF_NUM=10;
void __fastcall TForm1::ConnectBtnClick(TObject *Sender)
{
        String ReHostName;
          if(LocalState!=StateFree) return;//只有在空閒狀態才能呼叫
          ReHostName=MaskEdit->Text;
        while (Pos(' ',ReHostName)!=0)
        {
                Delete(ReHostName,Pos(' ',ReHostName),1);
                  if(Length(ReHostName)<7) return;
                  MsgClientSocket->Address=ReHostName;
                  MsgClientSocket->Active=True; //連接遠程機
                  LocalState=StateCalling;
                  ConnectBtn->Enabled=false;
                  HangupBtn->Enabled=true;
                  statusbar->Panels[0]->Text="正在呼叫";
        }
}    //MsgServerSocket回送消息
void __fastcall TForm1::FeedbackPassiveMsg(TPassiveMsg PassiveMsg,TCustomWinSocket Socket)
{
        MsgText[0]=Chr(Integer(PassiveMsg));//消息類型
        MsgText[1]=chr(Integer(LocalState));//本機狀態
           Socket->SendBuf(MsgText,2);
}    void __fastcall TForm1::FormCreate(TObject *Sender)
{
          int i;
          StatusBar->Panels[0]->Text="空閒";
          new(pWaveHdr1);
          new(pWaveHdr2);
          for(i=0;ilpData=Memos[i];
                    pWaveHdrs[i]->dwBufferLength= BUF_SIZE;
                    pWaveHdrs[i]->dwBytesRecorded=0;
                    pWaveHdrs[i]->dwUser=0;
                    pWaveHdrs[i]->dwFlags=0;
                    pWaveHdrs[i]->dwLoops=1;
                    pWaveHdrs[i]->lpNext=nil;
                    pWaveHdrs[i]->reserved=0;
             }
          MaskEdit->Color=RGB(8,214,251);
          label->Color=RGB(8,214,251);
          statusbar->Color=RGB(8,214,251);
}    //當消息服務器被連接時
void __fastcall TForm1::MsgClientSocketConnect(TObject *Sender,TCustomWinSocket Socket)
{
        if(LocalState==STateCalling) //如果本機正在呼叫
        {
            SendActiveMsg(MsgAttempTalk); //發出請求連接的消息
            StatusBar->Panels[0]->Text="正在接通...";
          }
}    //聲音播放
void __fastcall TForm1::PlayNotify(integer model)
{
        String filename;
        switch(model)
        {
              case 1: FileName="NOTIFY";
              case 2: FileName="CALL";
              case 3: FileName="BUSY";
              case 4: FileName="NOPHONE";
        }
        sndplaysound(pchar(filename),SND_LOOP OR SND_RESOURCE Or SND_ASYNC);
}    //發送消息到遠程機
void __fastcall TForm1::SendActiveMsg(TActiveMsg ActiveMsg)
{
           MsgText[0]=Chr(Integer(ActiveMsg));
           MsgText[1]=chr(Integer(LocalState));
           MsgClientSocket->Socket->SendBuf(MsgText,2);
}    //停止放音
void __fastcall TForm1::StopNotify()
{
        playSound(nil,0,0);
}    //消息服務器收到客戶機發來的消息
void __fastcall TForm1::MsgServerSocketClientRead(TObject *Sender,TCustomWinSocket Socket)
{
        TActiveMsg ActiveMsg;
          Socket->ReceiveBuf(msgText,2);
          ActiveMsg=TActiveMsg(MsgText[0]);
          switch(ActiveMsg)
        {
                     case MsgAttempTalk:  //接收到請求連接的消息
                       if(LocalState==StateFree) //如果本機空閒
                {
                        LocalState=StateBeCalled; //改變本機狀態為被呼叫
                         ConnectBtn->Enabled=false;
                         FeedbackPassiveMsg(MsgTalkAvialable,Socket); //回送可以連接的消息
                         //連接呼叫機
                         MsgClientSocket->Address= Socket->RemoteAddress;
                         MsgClientSocket->Active=true;
                         DataClientSocket->Address=Socket->RemoteAddress;
                         DataClientSocket->Active=true;
                }
                //本機不空閒
                else {FeedBackPassiveMsg(MsgPhoneBusy,Socket);}//回送忙消息                         case MsgAcceptTalk: //接收到被呼叫機發來的接聽消息
                LocalSTate:=StateTalking; //改變本機狀態為通話
                StatusBar.Panels[0].Text:='正在和' Socket.RemoteHost '通話';
                 StopNotify; //停止提示音
                 StartSendSound; //發送聲音
        }
}    //處理回送消息
void __fastcall TForm1::MsgClientSocketRead(TObject *Sender,TCustomWinSocket Socket)
{
        TPassiveMsg PassiveMsg;
        Socket->ReceiveBuf(MsgText,2);
          PassiveMsg=TPassiveMsg(MsgText[0]);
          switch(PassiveMsg)
        {
             case MsgTalkAvialable: //收到可以連接的消息
                       if(LocalState==STateCalling)  //如果本機正在呼叫
                {
                 StatusBar->Panels[0]->Text="已經接通";
                 //連接資料套接字
                 DataClientSocket->Address=Socket->RemoteAddress;
                 DataClientSocket->Active=True;
                }
             case MsgPhoneBusy://收到忙消息
                if(LocalState==STateCalling) //如果本機正在呼叫
                {
                 MsgClientSocket->Active=False;//斷開消息套接字
                 StatusBar->Panels[0]->Text="電話占線";
                 PlayNotify(3);  //發出占線提示音
                }
        }
}    //接聽
void __fastcall TForm1::AcceptBtnClick(TObject *Sender)
{
          if(LocalState!=StateBeCalled) return; //本機必須是被呼叫
          AcceptBtn->Enabled=false;
          SendActiveMsg(MsgAcceptTalk);//發送接聽消息
          stopnotify;   //停止響鈴
          LocalState=StateTalking;//改變本機狀態為通話
          StatusBar->Panels[0]->Text="正在和" MsgClientSocket.Socket.RemoteHost "通話";
          StartSendSound; //發送聲音
          HangUpBtn->Enabled=true;
}    //掛機
void __fastcall TForm1::HangUpBtnClick(TObject *Sender)
{
        if(LocalState==StateTalking)  //掛機
          {
            //斷開DateClientSocket和MsgClientSocket,, 改本機狀態為StateFree
            MsgClientSocket->Active=False;
            DataClientSocket->Active=False;
            LocalState=StateFree;
            StatusBar->Panels[0]->Text="空閒";
            stopnotify;  //當對方先掛機時,要掛機才停止提示音
            EndSendSound; //停止發送聲音
            //停止放音
            EndPlaySound;
            ConnectBtn->Enabled=true;
            HangUpBtn->Enabled=false;
          }
        else if(LocalState==StateCalling)  //放棄呼叫
        {
            MsgClientSocket->Active=false;
            DataClientSocket->Active=false;
            stopnotify;
            LocalState=StateFree;
            StatusBar->Panels[0]->Text="空閒";
            ConnectBtn->Enabled=true;
            HangUpBtn->Enabled=false;
        }
}    //資料服務器斷開,當對方掛機或放棄呼叫時發生
void __fastcall TForm1::DataServerSocketClientDisconnect(TObject *Sender,TCustomWinSocket Socket)
{
          //斷開DateClientSocket和MsgClientSocket
        DataClientSocket->Active=false;
          MsgClientSocket->Active=false;
          if(LocalState==STateTalking)   //對方掛機
        {
            //停止錄音和播音
            EndSendSound;
            EndPlaySound;
            Statusbar->Panels[0]->Text="對方已經掛機";
            Application->ProcessMessages;
            playNotify(3); //發出提示音
        }
}
void __fastcall TForm1::MsgServerSocketClientDisconnect(TObject *Sender,TCustomWinSocket Socket)
{
          if(LocalState==StateBeCalled) //對方放棄呼叫
        {
            DataClientSocket->Active=false;
            MsgClientSocket->Active=false;
           stopNotify;
            LocalSTate=StateFree;
            StatusBar->Panels[0]->Text="空閒";
            AcceptBtn->Enabled=false;
            ConnectBtn->Enabled=true;
        }
}
void __fastcall TForm1::FormDestroy(TObject *Sender)
{
        int i;
          dispose(pWaveHdr1);
          dispose(pWaveHdr2);
          for(i=0;ilParam)->lpData);
          count= (PWAVEHDR(Msg->lParam))->dwBytesRecorded;
          CopyMemory(Addr(pSaveBuf[0]),pBuffer,count);
          if(Count>0) {DataClientSocket->Socket->SendBuf(pSaveBuf,count);}
          waveInAddBuffer (hWaveIn, PWAVEHDR(Msg->lParam), sizeof (WAVEHDR)) ;
}
void __fastcall TForm1::mmwimopen(TMessage Msg)
{
        waveInAddBuffer(hWaveIn,pWaveHdr1,sizeof(WAVEHDR));
          waveInAddBuffer(hWaveIn,pWaveHdr2,sizeof(WAVEHDR));
          waveInStart(hWaveIn);
}    void __fastcall TForm1::EndSendSound()
{
  bEndRecord:=true;
  waveInReset(hwaveIn);
}
void __fastcall TForm1::StartSendSound()
{
        waveformIn.wFormatTag=WAVE_FORMAT_PCM;
           waveformIn.nChannels=1;
           waveformIn.nSamplesPerSec=11025;
           waveformIn.nAvgBytesPerSec=22050;
           waveformIn.nBlockAlign=1;
           waveformIn.wBitsPerSample=16;
           waveformIn.cbSize=0;
           if(WaveInOpen(@hWaveIn,WAVE_MAPPER,@waveformIn,handle,0,CALLBACK_WINDOW)
            <>MMSYSERR_NOERROR)
           {ShowMessage('錄音設備打開失敗');}
          pWaveHdr1.lpData=(pBuffer1);
          pWaveHdr1.dwBufferLength= BUF_SIZE;
          pWaveHdr1.dwBytesRecorded=0;
          pWaveHdr1.dwUser=0;
          pWaveHdr1.dwFlags=0;
          pWaveHdr1.dwLoops=1;
          pWaveHdr1.lpNext=nil;
          pWaveHdr1.reserved=0;
          waveInPrepareHeader(hWaveIn,pWaveHdr1,SizeOf(WAVEHDR));
          pWaveHdr2.lpData=(pBuffer2);
          pWaveHdr2.dwBufferLength= BUF_SIZE;
          pWaveHdr2.dwBytesRecorded=0;
          pWaveHdr2.dwUser=0;
          pWaveHdr2.dwFlags=0;
          pWaveHdr2.dwLoops=1;
          pWaveHdr2.lpNext=nil;
          pWaveHdr2.reserved=0;
          waveInPrepareHeader(hWaveIn,pWaveHdr2,SizeOf(WAVEHDR));
          bEndRecord=false;
}
void __fastcall TForm1::mmwomclose(TMessage Msg)
{
        int i;
          for(i=0;i0)
        {
             CurPlayMemo=(CurPlayMemo 1)%BUF_NUM;
             waveOutWrite(hWaveOut,pWaveHdrs[CurPlayMemo],sizeof(WAVEHDR));
             NeedPlayBufCount--;
        }
}
void __fastcall TForm1::mmwomopen(TMessage Msg)
{
          if((NeedPlayBufCount>0)&&(hWaveout!=0))
        {
        waveOutWrite(hWaveOUt,pWaveHdrs[CurPlayMemo],sizeof(WAVEHDR));
        }
}
void __fastcall TForm1::DataServerSocketClientConnect(TObject *Sender,TCustomWinSocket Socket)
{
            CurMemoIndex=0;
            CurPlayMemo=0;
            NeedPlayBufCount=0;
            if(LocalState==STateBeCalled)
            {
               PlayNotify(1);
               AcceptBtn.Enabled=true;
               statusbar->Panels[0]->Text="正在被" Socket.RemoteHost "呼叫";
            }
}    void __fastcall TForm1::DataServerSocketClientRead(TObject *Sender,TCustomWinSocket Socket)
{
        int count;
          count=Socket->ReceiveBuf(ReciBuf,BUF_SIZE);
          if(LocalState!=StateTalking) return;
          CopyMemory(Memos[CurMemoIndex],Addr(ReciBuf[0]),count);
         pWaveHdrs[CurMemoIndex].dwBufferLength=count;
          CurMemoIndex=(CurMemoIndex 1)%BUF_NUM;
          NeedPlayBufCount  ;
          if(bFirstReceive){StartPlaysound;}
          else if(NoDataInBuf)
            {waveOutWrite(hWaveOut,pWaveHdrs[CurPlayMemo],sizeof(WAVEHDR));}
}
void __fastcall TForm1::DataClientSocketConnect(TObject *Sender,TCustomWinSocket Socket)
{
          if(LocalState==StateCalling 
          {
            StatusBar->Panels[0]->Text="已經接通" Socket->RemoteHost;
            playnotify(2);
          }
}
void __fastcall TForm1::MsgClientSocketError(TObject *Sender,TCustomWinSocket Socket,TErrorEvent ErrorEvent,int ErrorCode)
{
        if(ErrorEvent=eeconnect)
        {
             playnotify(4);
             statusbar->panels[0]->Text="請掛機";
             Errorcode=0;
           }
}
void __fastcall TForm1::MsgClientSocketLookup(TObject *Sender,TCustomWinSocket Socket)
{
          if(LocalState==StateCalling) 
        {statusbar->panels[0]->Text="正在呼叫,請稍候...";}
}
void __fastcall TForm1::EndPlaySound()
{
          bEndPlay=true;
          WaveOutReset(hWaveOut);
          bFirstReceive=true;
}
void __fastcall TForm1::StartPlaySound()
{
          int i;  
          if(WaveOutOpen(@hWaveOut,WAVE_MAPPER,@waveformout,handle,0,CALLBACK_WINDOW)
        <>MMSYSERR_NOERROR) {ShowMessage('播放設備打開失敗')}
        else{
                for(i=0;iSendToBack;
            return;
          }
}
void __fastcall TForm1::Image1MouseUp(TObject *Sender,TMouseButton Button,TShiftState Shift,int X,int Y)
{
          Image2->SendToBack;
          if((X-284)*(X-284) (Y-114)*(Y-114)<16*16)
          {
            if(ConnectBtn->Enabled) {ConnectBtnclick(Sender);}
            else if(AcceptBtn->Enabled) {AcceptbtnClick(Sender);}
            else if(HangupBtn->Enabled {HangupBtnClick(Sender);}
          }
        else if ((X-12)*(X-12) (Y-12)*(Y-12)<9) exit(1);
}
void __fastcall TForm1::Image1MouseMove(TObject *Sender,TShiftState Shift,int X,int Y)
{
           if((X-284)*(X-284) (Y-114)*(Y-114)<16*16)
           {
            Cursor=CrHandPoint;
            if(ConnectBtn->Enabled) {StatusBar->Panels[1]->Text="呼叫";}
            else if(AcceptBtn->Enabled){StatusBar->Panels[1]->Text="接聽";}
            else if(HangupBtn->Enabled){StatusBar->Panels[1]->Text="掛機";}
           } 
        else if((X-12)*(X-12) (Y-12)*(Y-12)<9)
           {
             Cursor=CrHandPoint;
             StatusBar->Panels[1]->Text="關機";
           }  
        else
          {
               StatusBar->Panels[1]->Text="";
               CurSor=crDefault;
           }
}
void __fastcall TForm1::N4Click(TObject *Sender)
{
        exit(1);
}
void __fastcall TForm1::PopupMenu1Popup(TObject *Sender)
{
          N1->Enabled=ConnectBtn->Enabled;
          N2->Enabled=HangUPBtn->Enabled;
          N3->Enabled=AcceptBtn->Enabled;
}    
系統時間:2024-12-04 16:21:50
聯絡我們 | Delphi K.Top討論版
本站聲明
1. 本論壇為無營利行為之開放平台,所有文章都是由網友自行張貼,如牽涉到法律糾紛一切與本站無關。
2. 假如網友發表之內容涉及侵權,而損及您的利益,請立即通知版主刪除。
3. 請勿批評中華民國元首及政府或批評各政黨,是藍是綠本站無權干涉,但這裡不是政治性論壇!