?? openobjects.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 + -