virtintf.pas

来自「是 delphi6的函数库」· PAS 代码 · 共 79 行

PAS
79
字号

{*******************************************************}
{                                                       }
{       Borland Delphi Visual Component Library         }
{                                                       }
{   Copyright (c) 1995-2001 Borland Software Corp.      }
{                                                       }
{*******************************************************}

unit VirtIntf deprecated;

interface

type
  TInterface = class
  private
    FRefCount: Longint;
  public
    constructor Create;
    procedure Free;
    function AddRef: Longint; virtual; stdcall;
    function Release: Longint; virtual; stdcall;
    function GetVersion: Integer; virtual; stdcall;
  end;

  { IStreamModifyTime - Allows setting the file time stamp of an IStream }

  IStreamModifyTime = interface
    ['{12452621-5F8A-11D1-9FB6-0020AF3D82DA}']
    function GetModifyTime: Longint; stdcall;
    procedure SetModifyTime(Time: Longint); stdcall;
  end;

function ReleaseException: string;

implementation

uses SysUtils;

{ TInterface }

constructor TInterface.Create;
begin
  inherited Create;
  FRefCount := 1;
end;

procedure TInterface.Free;
begin
  if Self <> nil then Release;
end;

function TInterface.AddRef: Longint;
begin
  Inc(FRefCount);
  Result := FRefCount;
end;

function TInterface.Release: Longint;
begin
  Dec(FRefCount);
  Result := FRefCount;
  if FRefCount = 0 then Destroy;
end;

function TInterface.GetVersion: Integer;
begin
  Result := 3;
end;

{ Exception handling }

function ReleaseException: string;
begin
  Result := Exception(ExceptObject).Message;
end;

end.

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?