Delphi Programming Forum
C++Builder  |  Delphi  |  FireMonkey  |  C/C++  |  Free Pascal  |  Firebird
볼랜드포럼 BorlandForum
 경고! 게시물 작성자의 사전 허락없는 메일주소 추출행위 절대 금지
델파이 포럼
Q & A
FAQ
팁&트릭
강좌/문서
자료실
컴포넌트/라이브러리
FreePascal/Lazarus
볼랜드포럼 홈
헤드라인 뉴스
IT 뉴스
공지사항
자유게시판
해피 브레이크
공동 프로젝트
구인/구직
회원 장터
건의사항
운영진 게시판
회원 메뉴
북마크
델마당
볼랜드포럼 광고 모집

델파이 Q&A
Delphi Programming Q&A
[4405] >질문< async에서 팩스보내기
j1025427 [ ] 1510 읽음    1998-09-07 20:34
팩스걸기를하면 신호음이 안들림.

procedure Tallview.setmodem;
var
  tpbit : tparity;
  //tstop : tstopbits;
  ini : tinifile;
  baud, port, pbit, dbit, stop : string;
begin
memo2.clear;
if moset='1' then
begin
if fileexists('c:\telcon\modem.ini') then
  begin
  ini:=tinifile.create('c:\telcon\modem.ini');
  baud:=ini.readstring('modem','bps','error');
  port:=ini.readstring('modem','port','error');
  pbit:=ini.readstring('modem','pbit','error');
  dbit:=ini.readstring('modem','dbit','error');
  stop:=ini.readstring('modem','sbit','error');
  ini.destroy;
if allview.ApdComPort1.open<>false then
  allview.ApdComPort1.open:=false;
if baud='110' then
  begin
  ApdComPort1.Baud:=strtoint(baud);
  end
else
if baud='300' then
  begin
  ApdComPort1.Baud:=strtoint(baud);
  end
else
if baud='600' then
  begin
  ApdComPort1.Baud:=strtoint(baud);
  end
else
if baud='1200' then
  begin
  ApdComPort1.Baud:=strtoint(baud);
  end
else
if baud='2400' then
  begin
  ApdComPort1.Baud:=strtoint(baud);
  end
else
if baud='4800' then
  begin
  ApdComPort1.Baud:=strtoint(baud);
  end
else
if baud='9600' then
  begin
  ApdComPort1.Baud:=strtoint(baud);
  end
else
if baud='14400' then
  begin
  ApdComPort1.Baud:=strtoint(baud);
  end
else
if baud='19200' then
  begin
  ApdComPort1.Baud:=strtoint(baud);
  end
else
if baud='38400' then
  begin
  ApdComPort1.Baud:=strtoint(baud);
  end
else
if baud='56000' then
  begin
  ApdComPort1.Baud:=strtoint(baud);
  end
else
if baud='128000' then
  begin
  ApdComPort1.Baud:=strtoint(baud);
  end
else
if baud='256000' then
  begin
  ApdComPort1.Baud:=strtoint(baud);
  end;


if port='Com1' then
  begin
  ApdComPort1.comnumber:=1;
  end
else
if port='Com2' then
  begin
  ApdComPort1.comnumber:=2;
  end
else
if port='Com3' then
  begin
  ApdComPort1.comnumber:=3;
  end
else
if port='Com4' then
  begin
  ApdComPort1.comnumber:=4;
  end;

tpbit:=pNone;
if pbit='None' then
  begin
  tpbit:=pNone;
  end
else
if pbit='Odd' then
  begin
  tpbit:=pOdd;
  end
else
if pbit='Even' then
  begin
  tpbit:=pEven;
  end
else
if pbit='Mark' then
  begin
  tpbit:=pMark;
  end;
ApdComPort1.parity:=tpbit;
ApdComPort1.databits:=strtoint(dbit);
ApdComPort1.StopBits:=strtoint(stop);
end; //if exists ini
try
ApdComPort1.open:=true;
except
  on EBadId do
    begin
    end;
  on EInOutError do
    begin
    showmessage('모뎀이 부착되어있는지 확인하세요');
    end;
  end;
try
ApdComPort1.OutPut := 'ATZ'^M;
except
  on EOutputBufferTooSmall do
    begin
    end;
  end;
moset:='';
try
ApdModem1.Initialize;
except
  on EOutputBufferTooSmall do
    begin
    end;
  end;
end;
end;

procedure Tallview.sendfax(number:string);
var
  next : integer;
  filename : string;
begin
ApdSendFax1.DialAttempts:=1;
ApdSendFax1.DialRetryWait:=30;
//Link to the status display
//ApdSendFax1.StatusDisplay := ApdFaxStatus1;
//ApdFaxStatus1.Fax := ApdSendFax1;
ApdSendFax1.PhoneNumber:=number;
filename:=ApdSendFax1.FaxFile;
if (head=true) and (faxcnt=0)then
  begin
  ApdSendFax1.FaxFile:='';
  ApdSendFax1.FaxFilelist.clear;
  ApdSendFax1.FaxFilelist.add('c:\telcon\head.APF');
  ApdSendFax1.FaxFilelist.add(filename);
  faxcnt:=1;
  end;
//ApdSendFax1.FaxFile:=edit1.text;
//Send the fax



ApdSendFax1.StartTransmit;
//ApdSendFax1.dial;
end;

procedure Tallview.ApdSendFax1FaxFinish(CP: TObject; ErrorCode: Integer);
var
  er : string;
  next : integer;
begin
er:=ErrorMsg(ErrorCode);
edit1.text:=er;   //Bad response from modem
if er='Error While initializing modem' then
  begin
  apdmodem1.Initialize;
  if oneselect='2' then
    begin
    bitbtn3.OnClick(self);
    end
  else
    if oneselect='7' then
      begin
      if (yakallview.bitbtn5.visible=false) and (yakallview.bitbtn4.visible=false) then
        begin
        yakallview.bitbtn5.visible:=true;
        yakallview.bitbtn4.visible:=true;
        end;
      yakallview.bitbtn1.OnClick(self);
      end;
  end;
if (oneselect='2') and (cancelstr='0') then
  begin
  if er='OK' then
    begin
    bitbtn7.OnClick(self);//팩스가 성공적으로 끄ㅌ났을때 번호를 찾아오는 기능
    end
  else
    if er<>'Bad response from modem' then
      begin
      bitbtn6.OnClick(self);
      end
    else
      if apdcomport1.open=true then//apdcomport1.open이 true임에도 신호음이 안들이면
        begin
        apdmodem1.Initialize;
        showmessage('모뎀 초기화에 실패 했읍니다. 팩스걸기 버튼을 다시 눌러 주세요');
        ApdSendFax1.CancelFax;
        bitbtn1.onclick(self);
        end//이런다음 팩스 걸기 버튼을 다시 누르면 신호음이 들림.
      else  //그래서 팩스를 연결하고 팩스를 보내다가 상대편팩스에 '주의'가 깜박거리면서
        begin  //팩스보내기가 실패함. 어떤경우는 신호음도없이 다음번호를 거는데 역시 신호음은 계속안들리고 다음번호로 넘어감.
        showmessage('모뎀 초기화에 실패 했읍니다. 팩스걸기 버튼을 다시 눌러 주세요');
        ApdSendFax1.CancelFax;
        bitbtn1.onclick(self);
        end;
  end
else
  if (oneselect='7') and (cancelstr='0') then
    begin
    if er='OK' then
      begin
      if (yakallview.bitbtn5.visible=false) and (yakallview.bitbtn4.visible=false) then
        begin
        yakallview.bitbtn5.visible:=true;
        yakallview.bitbtn4.visible:=true;
        end;
      yakallview.bitbtn5.onclick(self);
      end
    else
      if er<>'Bad response from modem' then
        begin
        if (yakallview.bitbtn5.visible=false) and (yakallview.bitbtn4.visible=false) then
          begin
          yakallview.bitbtn5.visible:=true;
          yakallview.bitbtn4.visible:=true;
          end;
        yakallview.bitbtn4.onclick(self);
        end
      else
        if apdcomport1.open=true then
          begin
          apdmodem1.Initialize;
          showmessage('모뎀 초기화에 실패 했읍니다. 팩스걸기 버튼을 다시 눌러 주세요');
          ApdSendFax1.CancelFax;
          yakallview.bitbtn3.onclick(self);
//          timer2.Enabled:=true;
//          bitbtn1.onclick(self);
          end
        else
          begin
          showmessage('모뎀 초기화에 실패 했읍니다. 팩스걸기 버튼을 다시 눌러 주세요');
          ApdSendFax1.CancelFax;
          yakallview.bitbtn3.onclick(self);
          end;
    end;
end;

procedure Tallview.ApdSendFax1FaxStatus(CP: TObject; First, Last: Boolean);
begin
if (cancelstr='1') and (cancelstart='') then//취소버튼이 눌려지면 true
  begin    //procedure Tallview.ApdSendFax1FaxFinish(CP: TObject; ErrorCode: Integer);루틴을 돌 때는
  cancelstart:='1';        //안들어감.
  ApdSendFax1.CancelFax;
  end;
end;


+ -

관련 글 리스트
4405 >질문< async에서 팩스보내기 j1025427 1510 1998/09/07
Google
Copyright © 1999-2015, borlandforum.com. All right reserved.