⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 openobjects.pas

📁 .net 方面的开发说明资料。
💻 PAS
字号:
unit OpenObjects;

interface

uses
  Windows, SysUtils;

const
  DLL_NAME = 'OpenObjects.dll';
  GUID_OBJECT : TGUID = '{ed735269-e3d5-48f7-92e8-32453a154d41}';
  GUID_SERVICEMANAGER : TGUID = '{167002d3-3aac-49f9-9bad-842afcec7f5d}';
  CLSID_SERVICE_REGISTERABLE : TGUID = '{769d9567-1bc0-4097-a1ba-706e94db828b}';
  GUID_SERVICE_DLL : TGUID = '{e819a6e3-62ae-4f1d-9374-4fd4ea697edf}';

type
  PObjectInfo = ^ObjectInfo;
  PPointer = ^Pointer;

  // ========================================================
  // Function pointers to discover and create methods
  // ========================================================

  ObjectInitializeProc = procedure(); stdcall;
  ObjectCreateProc = function(iif : PPointer) : HRESULT; stdcall;

  // ========================================================
  // Information block for each object
  // ========================================================

  ObjectInfo = packed record
    family : TGUID;
    guid : TGUID;
    create : ObjectCreateProc;
    extra : Pointer;
  end;

  // ========================================================
  // Service (finds and instantiates objects in some
  // platform specific way. This needs to be reimplemented
  // per supported OS.
  // ========================================================

  IService = interface
    function CreateInstance(family : TGUID; guid : TGUID; obj : PPointer) : HRESULT; stdcall;
    function ObjectExists(family : TGUID; guid : TGUID) : Boolean; stdcall;
  end;

  // ========================================================
  // Interface for services where you can manually add components
  // ========================================================

  IServiceRegisterable = interface(IService)
    function RegisterComponent(family : TGUID; guid : TGUID; proc : ObjectCreateProc) : Boolean; stdcall;
  end;

  // ========================================================
  // Service Manager (finds and instantiates objects)
  // ========================================================

  IServiceManager = interface
    procedure Init;
    function AddService(guid : TGUID; service : IService) : HRESULT; stdcall;
    function RemoveService(guid : TGUID) : HRESULT; stdcall;
    function GetService(guid : TGUID; iif : PPointer) : HRESULT; stdcall;
    function CreateInstqnce(family : TGUID; guid : TGUID; obj : PPointer) : HRESULT; stdcall;
    function ObjectExists(family : TGUID; guid : TGUID) : Boolean; stdcall;
  end;

  // ----------------------------------------------------------
  // Purpose: Instantiates the service manager
  // Usage  : The service manager is the object that you use
  //          to find (discover) other components and to
  //          instantiate them.
  // Notes  : None
  // ----------------------------------------------------------

  function GetServiceManager(iif : PPointer) : HRESULT; stdcall; external DLL_NAME name '_GetServiceManager@4';
  function EpRegisterComponent(family : TGUID; id : TGUID; create : ObjectCreateProc) : HRESULT; stdcall; external DLL_NAME name '_EpRegisterComponent@36';
  function EpStringFromGuid(result : PChar; clsid : TGUID) : Integer; stdcall; external DLL_NAME name '_EpStringFromGuid@20';

implementation

end.

⌨️ 快捷键说明

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