📄 adfax.pas
字号:
FCtl3D : Boolean;
FVisible : Boolean;
FCaption : TCaption;
procedure Notification(AComponent : TComponent;
Operation: TOperation); override;
protected
FFax : TApdCustomAbstractFax;
procedure SetPosition(const NewPosition : TPosition);
procedure SetCtl3D(const NewCtl3D : Boolean);
procedure SetVisible(const NewVisible : Boolean);
procedure GetProperties;
procedure SetCaption(const NewCaption : TCaption);
procedure Show;
public
constructor Create(AOwner : TComponent); override;
{-Create a TApdAbstractStatus component}
destructor Destroy; override;
{-Destroy a TApdAbstractStatus component}
{.Z-}
procedure UpdateDisplay(const First, Last : Boolean); virtual; abstract;
{-Update the status display with current data}
procedure CreateDisplay; dynamic; abstract;
{-Create the status display}
procedure DestroyDisplay; dynamic; abstract;
{-Destroy the status display}
property Display : TForm
read FDisplay write FDisplay;
published
property Position : TPosition
read FPosition write SetPosition;
property Ctl3D : Boolean
read FCtl3D write SetCtl3D;
property Visible : Boolean
read FVisible write SetVisible;
property Fax : TApdCustomAbstractFax
read FFax write FFax;
property Caption : TCaption
read FCaption write SetCaption;
end;
{Builtin faxlog procedure}
TApdFaxLog = class(TApdBaseComponent)
protected
{.Z+}
FFaxHistoryName : TPassString; {!!.02}
FFax : TApdCustomAbstractFax;
procedure Notification(AComponent : TComponent;
Operation: TOperation); override;
public
constructor Create(AOwner : TComponent); override;
{-Create a TApdFaxLog component}
{.Z-}
function GetLogString(const Log : TFaxLogCode;
aFax : TApdCustomAbstractFax): string; virtual; {!!.04}
{-Returns a log string }
procedure UpdateLog(const Log : TFaxLogCode); virtual;
{-Add a log entry}
published
property FaxHistoryName : TPassString {!!.02}
read FFaxHistoryName write FFaxHistoryName;
property Fax : TApdCustomAbstractFax
read FFax write FFax;
end;
{Abstract fax component}
TApdAbstractFax = class(TApdCustomAbstractFax)
published
property InitBaud;
property NormalBaud;
property FaxClass;
property ModemInit;
property StationID;
property ComPort;
property TapiDevice;
property StatusDisplay;
property FaxLog;
property FaxFile;
property AbortNoConnect;
property ExitOnError;
property SoftwareFlow;
property StatusInterval;
property DesiredBPS;
property DesiredECM;
property FaxFileExt;
property OnFaxStatus;
property OnFaxLog;
property OnFaxError;
property OnFaxFinish;
end;
{Receive fax custom component}
TApdCustomReceiveFax = class(TApdAbstractFax)
protected
{General}
FFaxNameMode : TFaxNameMode; {Automatic fax name mode}
{Read only}
RingCount : Word; {Number of rings received so far}
FOnFaxAccept : TFaxAcceptEvent;
FOnFaxName : TFaxNameEvent;
{Property access methods}
function GetAnswerOnRing : Word;
procedure SetAnswerOnRing(const NewVal : Word);
function GetFaxAndData : Boolean;
procedure SetFaxAndData(const NewVal : Boolean);
function GetOneFax : Boolean;
procedure SetOneFax(NewValue : Boolean);
function GetConstantStatus : Boolean;
procedure SetConstantStatus(const NewValue : Boolean);
function GetDestinationDir : TPassString;
procedure SetDestinationDir(const NewDir : TPassString);
{Event message methods}
procedure apwFaxAccept(CP : TObject; var Accept : Boolean); virtual;
procedure apwFaxName(CP : TObject; var Name : TPassString); virtual;
public
{Properties}
property AnswerOnRing : Word
read GetAnswerOnRing write SetAnswerOnRing default adfDefAnswerOnRing;
property FaxAndData : Boolean
read GetFaxAndData write SetFaxAndData default adfDefFaxAndData;
property FaxNameMode : TFaxNameMode
read FFaxNameMode write FFaxNameMode default adfDefFaxNameMode;
property OneFax : Boolean
read GetOneFax write SetOneFax default adfDefOneFax;
property ConstantStatus : Boolean
read GetConstantStatus write SetConstantStatus default adfDefConstantStatus;
property DestinationDir : TPassString
read GetDestinationDir write SetDestinationDir;
{Event properties}
property OnFaxAccept : TFaxAcceptEvent
read FOnFaxAccept write FOnFaxAccept;
property OnFaxName : TFaxNameEvent
read FOnFaxName write FOnFaxName;
{ TAPI integration stuff }
procedure PrepareTapi; override;
procedure UnprepareTapi; override;
procedure TapiPassiveAnswer;
procedure FaxTapiStatus(CP: TObject; First, Last: Boolean;
Device, Message, Param1, Param2, Param3: LongInt);
public
{Creation/destruction}
constructor Create(AOwner : TComponent); override;
{-Create a TApdReceiveFax component}
destructor Destroy; override;
{-Destroy a TApdReceiveFax component}
{User control}
procedure InitModemForFaxReceive;
{-Send necessary commands to initialize modem for fax receive}
procedure PrepareConnectInProgress;
{-Prepare to connect to a fax session already in progress}
procedure StartReceive;
{-Start a background fax receive session}
procedure StartManualReceive(SendATAToModem : Boolean);
{-Start an immediate receive, optionally picking up call with modem}
end;
{Receive fax component}
TApdReceiveFax = class(TApdCustomReceiveFax)
published
property AnswerOnRing;
property FaxAndData;
property FaxNameMode;
property OneFax;
property ConstantStatus;
property DestinationDir;
property OnFaxAccept;
property OnFaxName;
end;
{Send fax component}
TApdCustomSendFax = class(TApdAbstractFax)
protected
{Private}
WasSent : Boolean;
{Properties}
FCoverFile : TPassString;
FFaxFileList : TStringList;
FPhoneNumber : TPassString;
{Event properties}
FOnFaxNext : TFaxNextEvent;
{Property access methods}
function GetFastPage : Boolean;
procedure SetFastPage(const NewVal : Boolean);
function GetEnhTextEnabled : Boolean;
procedure SetEnhTextEnabled(const NewVal : Boolean);
function GetEnhHeaderFont : TFont;
procedure SetEnhHeaderFont(const NewVal : TFont);
function GetEnhFont : TFont;
procedure SetEnhFont(const NewVal : TFont);
procedure SetFaxFileList(const NewVal : TStringList);
function GetFaxFile : TPassString; override;
procedure SetFaxFile(const NewFile : TPassString); override;
function GetBlindDial : Boolean;
procedure SetBlindDial(const NewVal : Boolean);
function GetDetectBusy : Boolean;
procedure SetDetectBusy(const NewVal : Boolean);
function GetToneDial : Boolean;
procedure SetToneDial(const NewVal : Boolean);
function GetDialPrefix : TModemString;
procedure SetDialPrefix(const NewPrefix : TModemString);
function GetDialWait : Word;
procedure SetDialWait(const NewWait : Word);
function GetDialAttempts : Word;
procedure SetDialAttempts(const NewAttempts : Word);
function GetDialRetryWait : Word;
procedure SetDialRetryWait(const NewWait : Word);
function GetMaxSendCount : Word;
procedure SetMaxSendCount(const NewCount : Word);
function GetBufferMinimum : Word;
procedure SetBufferMinimum(const NewMin : Word);
function GetHeaderLine : TPassString;
procedure SetHeaderLine(const S : TPassString);
function GetDialAttempt : Word;
function GetSafeMode : Boolean;
procedure SetSafeMode(NewMode : Boolean);
function GetHeaderSender : TPassString;
procedure SetHeaderSender(const NewSender : TPassString);
function GetHeaderRecipient : TPassString;
procedure SetHeaderRecipient(const NewRecipient : TPassString);
function GetHeaderTitle : TPassString;
procedure SetHeaderTitle(const NewTitle : TPassString);
{Event methods}
procedure apwFaxNext(CP : TObject;
var APhoneNumber : TPassString;
var AFaxFile : TPassString;
var ACoverFile : TPassString); virtual;
public
{Read/write properties}
property FastPage : Boolean
read GetFastPage write SetFastPage;
property EnhTextEnabled : Boolean
read GetEnhTextEnabled write SetEnhTextEnabled;
property EnhHeaderFont : TFont
read GetEnhHeaderFont write SetEnhHeaderFont;
property EnhFont : TFont
read GetEnhFont write SetEnhFont;
property FaxFileList : TStringList
read FFaxFileList write SetFaxFileList;
property BlindDial : Boolean
read GetBlindDial write SetBlindDial default adfDefBlindDial;
property DetectBusy : Boolean
read GetDetectBusy write SetDetectBusy default adfDefDetectBusy;
property ToneDial : Boolean
read GetToneDial write SetToneDial default adfDefToneDial;
property DialPrefix : TModemString
read GetDialPrefix write SetDialPrefix;
property DialWait : Word
read GetDialWait write SetDialWait default adfDefDialWait;
property DialAttempts : Word
read GetDialAttempts write SetDialAttempts default adfDefDialAttempts;
property DialRetryWait : Word
read GetDialRetryWait write SetDialRetryWait default adfDefDialRetryWait;
property MaxSendCount : Word
read GetMaxSendCount write SetMaxSendCount default adfDefMaxSendCount;
property BufferMinimum : Word
read GetBufferMinimum write SetBufferMinimum default adfDefBufferMinimum;
property HeaderLine : TPassString
read GetHeaderLine write SetHeaderLine;
property CoverFile : TPassString
read FCoverFile write FCoverFile;
property PhoneNumber : TPassString
read FPhoneNumber write FPhoneNumber;
property SafeMode : Boolean
read GetSafeMode write SetSafeMode default adfDefSafeMode;
property HeaderSender : TPassString
read GetHeaderSender write SetHeaderSender;
property HeaderRecipient : TPassString
read GetHeaderRecipient write SetHeaderRecipient;
property HeaderTitle : TPassString
read GetHeaderTitle write SetHeaderTitle;
{Read only properties}
property DialAttempt : Word
read GetDialAttempt;
{Events}
property OnFaxNext : TFaxNextEvent
read FOnFaxNext write FOnFaxNext;
public
{Creation/destruction}
constructor Create(AOwner : TComponent); override;
{-Create a TApdSendFax component}
destructor Destroy; override;
{-Destroy a TApdSendFax component}
procedure ConvertCover(const InCover, OutCover : string);
{Replace the tags in a text cover page }
procedure ConcatFaxes(FileName : TPassString);
{-Concat faxes in list to single file}
procedure StartTransmit;
{-Start a background fax send session}
procedure StartManualTransmit;
{-Start a background fax send session, already in progress}
end;
{Send fax component}
TApdSendFax = class(TApdCustomSendFax)
published
property EnhTextEnabled;
property EnhHeaderFont;
property EnhFont;
property FaxFileList;
property BlindDial;
property DetectBusy;
property ToneDial;
property DialPrefix;
property DialWait;
property DialAttempts;
property DialRetryWait;
property MaxSendCount;
property BufferMinimum;
property HeaderLine;
property CoverFile;
property PhoneNumber;
property SafeMode;
property DialAttempt;
property OnFaxNext;
property HeaderSender;
property HeaderRecipient;
property HeaderTitle;
end;
implementation
type
{A list of active TApdXxxFax components}
PFaxWindowNode = ^TFaxWindowNode;
TFaxWindowNode = record
fwWindow : TApdHwnd;
fwFax : TApdCustomAbstractFax;
end;
var
FaxList : TList;
{Message handling window for all fax components}
function FindFax(Handle : TApdHwnd) : TApdCustomAbstractFax;
{-Return fax component for this window handle}
var
I : Integer;
begin
for I := 0 to FaxList.Count-1 do begin
with PFaxWindowNode(FaxList.Items[I])^ do begin
if fwWindow = Handle then begin
Result := fwFax;
Exit;
end;
end;
end;
Result := nil;
end;
function FaxMessageHandler(hWindow : TApdHwnd; Msg, wParam : Integer;
lParam : LongInt) : LongInt; stdcall; export;
{-Window procedure for all APW_FAXXxx messages}
const
BoolRes : array[Boolean] of LongInt = (0, 1);
var
P : TApdCustomAbstractFax;
Accept : Boolean;
FName : TPassString;
Number : TPassString;
CoverName : TPassString;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -