📄 types.pas
字号:
{ Attempted to use an object that is busy. }
STG_E_INUSE = HRESULT($80030100);
//! {$EXTERNALSYM STG_E_INUSE}
{ The storage has been changed since the last commit. }
STG_E_NOTCURRENT = HRESULT($80030101);
//! {$EXTERNALSYM STG_E_NOTCURRENT}
{ Attempted to use an object that has ceased to exist. }
STG_E_REVERTED = HRESULT($80030102);
//! {$EXTERNALSYM STG_E_REVERTED}
{ Can't save. }
STG_E_CANTSAVE = HRESULT($80030103);
//! {$EXTERNALSYM STG_E_CANTSAVE}
{ The compound file %l was produced with an incompatible version of storage. }
STG_E_OLDFORMAT = HRESULT($80030104);
//! {$EXTERNALSYM STG_E_OLDFORMAT}
{ The compound file %l was produced with a newer version of storage. }
STG_E_OLDDLL = HRESULT($80030105);
//! {$EXTERNALSYM STG_E_OLDDLL}
{ Share.exe or equivalent is required for operation. }
STG_E_SHAREREQUIRED = HRESULT($80030106);
//! {$EXTERNALSYM STG_E_SHAREREQUIRED}
{ Illegal operation called on non-file based storage. }
STG_E_NOTFILEBASEDSTORAGE = HRESULT($80030107);
//! {$EXTERNALSYM STG_E_NOTFILEBASEDSTORAGE}
{ Illegal operation called on object with extant marshallings. }
STG_E_EXTANTMARSHALLINGS = HRESULT($80030108);
//! {$EXTERNALSYM STG_E_EXTANTMARSHALLINGS}
{ The docfile has been corrupted. }
STG_E_DOCFILECORRUPT = HRESULT($80030109);
//! {$EXTERNALSYM STG_E_DOCFILECORRUPT}
{ OLE32.DLL has been loaded at the wrong address. }
STG_E_BADBASEADDRESS = HRESULT($80030110);
//! {$EXTERNALSYM STG_E_BADBASEADDRESS}
{ The file download was aborted abnormally. The file is incomplete. }
STG_E_INCOMPLETE = HRESULT($80030201);
//! {$EXTERNALSYM STG_E_INCOMPLETE}
{ The file download has been terminated. }
STG_E_TERMINATED = HRESULT($80030202);
//! {$EXTERNALSYM STG_E_TERMINATED}
{ The underlying file was converted to compound file format. }
STG_S_CONVERTED = $00030200;
//! {$EXTERNALSYM STG_S_CONVERTED}
{ The storage operation should block until more data is available. }
STG_S_BLOCK = $00030201;
//! {$EXTERNALSYM STG_S_BLOCK}
{ The storage operation should retry immediately. }
STG_S_RETRYNOW = $00030202;
//! {$EXTERNALSYM STG_S_RETRYNOW}
{ The notified event sink will not influence the storage operation. }
STG_S_MONITORING = $00030203;
//! {$EXTERNALSYM STG_S_MONITORING}
GUID_NULL: TGUID = '{00000000-0000-0000-0000-000000000000}';
type
TOleChar = WideChar;
POleStr = PWideChar;
PPOleStr = ^POleStr;
PCLSID = PGUID;
TCLSID = TGUID;
{ 64-bit large integer }
Largeint = Int64;
{$EXTERNALSYM Largeint}
// DWORD = LongWord;
// {$EXTERNALSYM DWORD}
PDWORD = ^DWORD;
{$EXTERNALSYM PDWORD}
{ File System time stamps are represented with the following structure: }
PFileTime = ^TFileTime;
_FILETIME = packed record
dwLowDateTime: DWORD;
dwHighDateTime: DWORD;
end;
//! {$EXTERNALSYM _FILETIME}
TFileTime = _FILETIME;
FILETIME = _FILETIME;
//! {$EXTERNALSYM FILETIME}
{ IStream interface }
PStatStg = ^TStatStg;
//! {$EXTERNALSYM tagSTATSTG}
tagSTATSTG = packed record
pwcsName: POleStr;
dwType: Longint;
cbSize: Largeint;
mtime: TFileTime;
ctime: TFileTime;
atime: TFileTime;
grfMode: Longint;
grfLocksSupported: Longint;
clsid: TCLSID;
grfStateBits: Longint;
reserved: Longint;
end;
TStatStg = tagSTATSTG;
//! {$EXTERNALSYM STATSTG}
STATSTG = TStatStg;
IClassFactory = interface(IUnknown)
['{00000001-0000-0000-C000-000000000046}']
function CreateInstance(const unkOuter: IUnknown; const iid: TGUID;
out obj): HResult; stdcall;
function LockServer(fLock: LongBool): HResult; stdcall;
end;
ISequentialStream = interface(IUnknown)
['{0c733a30-2a1c-11ce-ade5-00aa0044773d}']
function Read(pv: Pointer; cb: Longint; pcbRead: PLongint): HResult;
stdcall;
function Write(pv: Pointer; cb: Longint; pcbWritten: PLongint): HResult;
stdcall;
end;
//{$EXTERNALSYM ISequentialStream}
IStream = interface(ISequentialStream)
['{0000000C-0000-0000-C000-000000000046}']
function Seek(dlibMove: Largeint; dwOrigin: Longint;
out libNewPosition: Largeint): HResult; stdcall;
function SetSize(libNewSize: Largeint): HResult; stdcall;
function CopyTo(stm: IStream; cb: Largeint; out cbRead: Largeint;
out cbWritten: Largeint): HResult; stdcall;
function Commit(grfCommitFlags: Longint): HResult; stdcall;
function Revert: HResult; stdcall;
function LockRegion(libOffset: Largeint; cb: Largeint;
dwLockType: Longint): HResult; stdcall;
function UnlockRegion(libOffset: Largeint; cb: Largeint;
dwLockType: Longint): HResult; stdcall;
function Stat(out statstg: TStatStg; grfStatFlag: Longint): HResult;
stdcall;
function Clone(out stm: IStream): HResult; stdcall;
end;
//{$EXTERNALSYM IStream}
{$ENDIF} { LINUX }
function EqualRect(const R1, R2: TRect): Boolean;
function Rect(Left, Top, Right, Bottom: Integer): TRect;
{$EXTERNALSYM Rect}
function Bounds(ALeft, ATop, AWidth, AHeight: Integer): TRect;
{$EXTERNALSYM Bounds}
function Point(X, Y: Integer): TPoint;
{$EXTERNALSYM Point}
function PtInRect(const Rect: TRect; const P: TPoint): Boolean;
function IntersectRect(out Rect: TRect; const R1, R2: TRect): Boolean;
function UnionRect(out Rect: TRect; const R1, R2: TRect): Boolean;
function IsRectEmpty(const Rect: TRect): Boolean;
function OffsetRect(var Rect: TRect; DX: Integer; DY: Integer): Boolean;
function CenterPoint(const Rect: TRect): TPoint;
type
TValueRelationship = -1..1;
const
LessThanValue = Low(TValueRelationship);
EqualsValue = 0;
GreaterThanValue = High(TValueRelationship);
implementation
function EqualRect(const R1, R2: TRect): Boolean;
begin
Result := (R1.Left = R2.Left) and (R1.Right = R2.Right) and
(R1.Top = R2.Top) and (R1.Bottom = R2.Bottom);
end;
function Rect(Left, Top, Right, Bottom: Integer): TRect;
begin
Result.Left := Left;
Result.Top := Top;
Result.Bottom := Bottom;
Result.Right := Right;
end;
function Point(X, Y: Integer): TPoint;
begin
Result.X := X;
Result.Y := Y;
end;
function PtInRect(const Rect: TRect; const P: TPoint): Boolean;
begin
Result := (P.X >= Rect.Left) and (P.X < Rect.Right) and (P.Y >= Rect.Top)
and (P.Y < Rect.Bottom);
end;
function IntersectRect(out Rect: TRect; const R1, R2: TRect): Boolean;
begin
Rect := R1;
if R2.Left > R1.Left then Rect.Left := R2.Left;
if R2.Top > R1.Top then Rect.Top := R2.Top;
if R2.Right < R1.Right then Rect.Right := R2.Right;
if R2.Bottom < R1.Bottom then Rect.Bottom := R2.Bottom;
Result := not IsRectEmpty(Rect);
if not Result then FillChar(Rect, SizeOf(Rect), 0);
end;
function UnionRect(out Rect: TRect; const R1, R2: TRect): Boolean;
begin
Rect := R1;
if not IsRectEmpty(R2) then
begin
if R2.Left < R1.Left then Rect.Left := R2.Left;
if R2.Top < R1.Top then Rect.Top := R2.Top;
if R2.Right > R1.Right then Rect.Right := R2.Right;
if R2.Bottom > R1.Bottom then Rect.Bottom := R2.Bottom;
end;
Result := not IsRectEmpty(Rect);
if not Result then FillChar(Rect, SizeOf(Rect), 0);
end;
function IsRectEmpty(const Rect: TRect): Boolean;
begin
Result := (Rect.Right <= Rect.Left) or (Rect.Bottom <= Rect.Top);
end;
function OffsetRect(var Rect: TRect; DX: Integer; DY: Integer): Boolean;
begin
if @Rect <> nil then // Test to increase compatiblity with Windows
begin
Inc(Rect.Left, DX);
Inc(Rect.Right, DX);
Inc(Rect.Top, DY);
Inc(Rect.Bottom, DY);
Result := True;
end
else
Result := False;
end;
function Bounds(ALeft, ATop, AWidth, AHeight: Integer): TRect;
begin
with Result do
begin
Left := ALeft;
Top := ATop;
Right := ALeft + AWidth;
Bottom := ATop + AHeight;
end;
end;
function CenterPoint(const Rect: TRect): TPoint;
begin
with Rect do
begin
Result.X := (Right - Left) div 2 + Left;
Result.Y := (Bottom - Top) div 2 + Top;
end;
end;
end.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -