📄 oomisc.pas
字号:
{*********************************************************}
{* OOMISC.PAS 4.04 *}
{* Copyright (C) TurboPower Software 1996-2002 *}
{* All rights reserved. *}
{*********************************************************}
{Global defines potentially affecting this unit}
{$I AWDEFINE.INC}
{Options required for this unit}
{$IFNDEF Win32}
{$L-}
{$ENDIF}
unit OoMisc;
{-Unit for miscellaneous routines}
interface
uses
WinTypes,
WinProcs,
{$IFNDEF PrnDrv}
Classes,
Controls,
ShellAPI,
OleCtrls,
Forms,
{$IFNDEF DrvInst}
Graphics,
{$ENDIF}
{$ENDIF}
MMSystem,
SysUtils,
Messages;
{ need this for the 16-bit printer drivers }
{$IFNDEF UseResourceStrings}
{$IFDEF Win32}
{$R APRO.R32}
{$ELSE}
{$R APRO.R16}
{$ENDIF}
{$ENDIF}
const
{$IFDEF TRIALRUN}
ApVersionStr = 'v4.04 Trial';
{$ELSE}
ApVersionStr = 'v4.04';
{$ENDIF}
{$IFDEF Apax}
{$IFDEF APAXTRIALRUN}
ApaxVersionStr = 'v1.12 beta Demo';
{$ELSE}
ApaxVersionStr = 'v1.12 beta';
{$ENDIF}
{$ENDIF}
{ Product name}
ApdProductName = 'Async Professional';
ApdShortProductName = 'APRO';
ApdVendor = 'TurboPower Software Company';
ApdVendorURL = 'http://www.TurboPower.com';
{ Version numbers }
ApdXSLImplementation = 0.0;
ApdXMLSpecification = '1.0';
{$IFDEF Win32}
fsPathName = 255;
fsDirectory = 255;
fsFileName = 255;
fsExtension = 255;
fsName = 255;
{$ELSE}
fsPathName = 79;
fsDirectory = 67;
fsFileName = 8;
fsExtension = 4;
fsName = 12;
{$ENDIF}
{shareable reading file mode}
ApdShareFileRead = $40;
const
ApdDefFileName = 'C:\DEFAULT.APF';
ApdPipeTimeout = 5000; { ms }
ApdPipeName = '\\.\pipe\ApFaxCnv';
ApdSemaphoreName = 'ApFaxCnvSem';
ApdRegKey = '\SOFTWARE\TurboPower\ApFaxCnv\Settings';
ApdIniFileName = 'APFPDENG.INI';
ApdIniSection = 'Settings';
ApdIniKey = 'AutoExec';
ApdDef32PrinterName = 'APF Fax Printer';
ApdDef16PrinterName = 'Print To Fax';
ApdDefPrinterPort = 'PRINTFAX';
ApdDefaultTerminalName = '<default>';
ApdNoTerminalName = '<none>';
{Event codes: (inbound)}
eNull = 0;
eStartDoc = 1;
eEndDoc = 2;
{Event codes: (outbound)}
eSetFileName = 3;
{$IFDEF Win32}
type
TPipeEvent = record
Event : Byte;
Data : ShortString;
end;
{$IFNDEF Delphi5}
TOleEnum = type DWORD;
{$ENDIF}
{ XML definitions }
DOMString = WideString;
{$ENDIF}
{$IFNDEF Win32}
type
{ define some types used by the 16-bit fax printer driver }
AnsiChar = Char;
PAnsiChar = PChar;
AnsiString = string;
ShortString = string;
POverlapped = pointer;
DWORD = LongInt;
{$ENDIF}
type
CharSet = set of char;
{$IFDEF AProBCB}
{$IFDEF Ver140}
TPassString = string;
{$ELSE}
TPassString = string[255];
{$ENDIF}
TApdHwnd = Integer;
{$ELSE}
TPassString = string[255];
TApdHwnd = HWND;
{$ENDIF}
{Standard event timer record structure used by all timing routines}
EventTimer = record
StartTicks : LongInt; {Tick count when timer was initialized}
ExpireTicks : LongInt; {Tick count when timer will expire}
end;
const
{Compile-time configurations}
{$IFDEF Win32}
MaxComHandles = 50; {Max comm ports open at once}
{$ELSE}
MaxComHandles = 10; {Max comm ports open at once}
{$ENDIF}
DispatchBufferSize = 8192; {Size of each port's dispatch buffer}
MaxMessageLen = 80; {All error and status strings less than 80}
{For skipping line parameter changes}
DontChangeBaud = 0;
DontChangeParity = SpaceParity + 1;
DontChangeDatabits = 9;
DontChangeStopbits = TwoStopbits + 1;
{Modem status trigger options}
msCTSDelta = $0010;
msDSRDelta = $0020;
msRingDelta = $0004;
msDCDDelta = $0080;
{Line status trigger options}
lsOverrun = $0001;
lsParity = $0002;
lsFraming = $0004;
lsBreak = $0008;
{Line and driver errors}
leNoError = 0; {No error, ordinal value matches ecOK}
leBuffer = 1; {Buffer overrun in COMM.DRV}
leOverrun = 2; {UART receiver overrun}
leParity = 3; {UART receiver parity error}
leFraming = 4; {UART receiver framing error}
leCTSTO = 5; {Transmit timeout waiting for CTS}
leDSRTO = 6; {Transmit timeout waiting for DSR}
leDCDTO = 7; {Transmit timeout waiting for RLSD}
leTxFull = 8; {Transmit queue is full}
leBreak = 9; {Break condition received}
{Status trigger subtypes}
stNotActive = 0; {not active}
stModem = 1; {Trigger on modem status change}
stLine = 2; {Trigger on line status change}
stOutBuffFree = 3; {Trigger on outbuff free level}
stOutBuffUsed = 4; {Trigger on outbuff used level}
stOutSent = 5; {Trigger on any PutXxx call}
{Next file method}
nfNone = 0; {No next file method specified}
nfMask = 1; {Use built-in next file mask method}
nfList = 2; {Use built-in next file list method}
{Action to take if incoming file exists}
wfcWriteNone = 0; {No option set yet}
wfcWriteFail = 1; {Fail the open attempt}
wfcWriteRename = 2; {Rename the incoming file}
wfcWriteAnyway = 3; {Overwrite the existing file}
wfcWriteResume = 4; {Resume an interrupted receive}
{Ascii CR/LF translation options}
atNone = 0; {No CR/LF translations}
atStrip = 1; {Strip CRs or LFs}
atAddCRBefore = 2; {Add CR before each LF}
atAddLFAfter = 3; {Add LF after each CR}
atEOFMarker : char = ^Z; {Add constant for standard EOF }
{Protocol status start/end flags}
apFirstCall = $01; {Indicates the first call to status}
apLastCall = $02; {Indicates the last call to status}
{For specifying log file calls}
lfReceiveStart = 0; {Receive starting}
lfReceiveOk = 1; {File received ok}
lfReceiveFail = 2; {File receive failed}
lfReceiveSkip = 3; {File was rejected by receiver}
lfTransmitStart = 4; {Transmit starting}
lfTransmitOk = 5; {File was transmitted ok}
lfTransmitFail = 6; {File transmit failed}
lfTransmitSkip = 7; {File was skipped, rejected by receiver}
type
{Convenient types used by protocols}
TNameCharArray = array[0..fsFileName ] of Char;
TExtCharArray = array[0..fsExtension] of Char;
TPathCharArray = array[0..fsPathName ] of Char;
TDirCharArray = array[0..fsDirectory] of Char;
TChar20Array = array[0..20] of Char;
TCharArray = array[0..255] of Char;
{For generic buffer typecasts}
PByteBuffer = ^TByteBuffer;
TByteBuffer = array[1..65535] of Byte;
{Port characteristic constants}
TDatabits = 5..DontChangeDatabits;
TStopbits = 1..DontChangeStopbits;
{NotifyProc type, same as a window procedure}
TApdNotifyProc = procedure(Msg, wParam : Cardinal;
lParam : Longint);
TApdNotifyEvent = procedure(Msg, wParam : Cardinal;
lParam : Longint) of object;
const
{Avoid requiring WIN31}
ev_CTSS = $0400; {CTS state}
ev_DSRS = $0800; {DSR state}
ev_RLSDS = $1000; {RLSD state}
ev_RingTe = $2000; {Ring trailing edge indicator}
const
{MSRShadow register from COMM.DRV}
MsrShadowOfs = 35; {Offset of MSRShadow from EventWord}
const
{Modem status bit masks}
DeltaCTSMask = $01; {CTS changed since last read}
DeltaDSRMask = $02; {DSR changed since last read}
DeltaRIMask = $04; {RI changed since last read}
DeltaDCDMask = $08; {DCD changed since last read}
CTSMask = $10; {Clear to send}
DSRMask = $20; {Data set ready}
RIMask = $40; {Ring indicator}
DCDMask = $80; {Data carrier detect}
const
{Message base}
apw_First = $7E00; {Sets base for all APW messages}
const
{Custom message types}
apw_TriggerAvail = apw_First+1; {Trigger for any data avail}
apw_TriggerData = apw_First+2; {Trigger data}
apw_TriggerTimer = apw_First+3; {Trigger timer}
apw_TriggerStatus = apw_First+4; {Status change (modem, line, buffer)}
apw_FromYmodem = apw_First+5; {Tells Xmodem it was called from Ymodem}
apw_PortOpen = apw_First+8; {Apro, tell users port open}
apw_PortClose = apw_First+9; {Apro, tell users port closed}
apw_ClosePending = apw_First+10; {Apro, tell ourself that the port was closed}
const
{Protocol message types}
apw_ProtocolCancel = apw_First+20; {To protocol - chk for protcl abort}
apw_ProtocolStatus = apw_First+21; {From protocol - update status display}
apw_ProtocolLog = apw_First+22; {From protocol - LogFile message}
apw_ProtocolNextFile = apw_First+23; {From protocol - return next file}
apw_ProtocolAcceptFile = apw_First+24; {From protocol - accept file}
apw_ProtocolFinish = apw_First+25; {From protocol - protocol is finished}
apw_ProtocolResume = apw_First+26; {From protocol - resume request}
apw_ProtocolError = apw_First+27; {From protocol - error during protocol}
apw_ProtocolAbort = apw_First+28; {To protocol - abort the transfer}
const
{Modem message types}
apw_AutoAnswer = apw_First+40; {To modem, enter AutoAnswer}
apw_CancelCall = apw_First+41; {To modem, cancel the call}
apw_StartDial = apw_First+42; {To modem, start the process}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -