MSC: TMSComm;
procedure TfmMain.MSCComm(Sender: TObject);
var
tempstr,SendCommand:string;
ee:char;
begin
// Application.MessageBox('有信息发送过来',Pchar('来电显'+Msc.Input),0);
MessageStr:=MessageStr+ Msc.Input;
ShowMessage( MessageStr);
if(Msc.CommEvent=comEvReceive) then
begin
tempstr:=Msc.Input;
tempstr:=trim(tempstr);
ShowMessage(tempstr);
StatusBar.Panels[0].Text:=tempstr;
if(AnsiUpperCase(tempStr)='RING') then
begin
StatusBar.Panels[0].Text:='有来电,请处理......';
MediaPlayer.FileName:='a.wav';
MediaPlayer.Open;
MediaPlayer.Play;
end;
end;
end;
procedure TfmMain.FormClose(Sender: TObject; var Action: TCloseAction);
begin
if MSC.PortOpen then
MSC.PortOpen:=false;
end;
procedure TfmMain.SpeedButton1Click(Sender: TObject);
begin
If MSC.PortOpen Then
MSC.PortOpen:= False;
MSC.CommPort:=1;
Msc.PortOpen:=true;
fmMain.Caption:='来电显示演示程序';
Msc.InputMode:=comInputModeText;
// MSC.Output:='AT#CID=1'+#13;
// MSC.Output:='AtS0=0'+#13;
end;