📄 pcohelloworld_tlb.pas
字号:
unit PcoHelloWorld_TLB;
// ************************************************************************ //
// WARNING
// -------
// The types declared in this file were generated from data read from a
// Type Library. If this type library is explicitly or indirectly (via
// another type library referring to this type library) re-imported, or the
// 'Refresh' command of the Type Library Editor activated while editing the
// Type Library, the contents of this file will be regenerated and all
// manual modifications will be lost.
// ************************************************************************ //
// PASTLWTR : $Revision: 1.88 $
// File generated on 1999/10/5 AM 12:51:08 from Type Library described below.
// *************************************************************************//
// NOTE:
// Items guarded by $IFDEF_LIVE_SERVER_AT_DESIGN_TIME are used by properties
// which return objects that may need to be explicitly created via a function
// call prior to any access via the property. These items have been disabled
// in order to prevent accidental use from within the object inspector. You
// may enable them by defining LIVE_SERVER_AT_DESIGN_TIME or by selectively
// removing them from the $IFDEF blocks. However, such items must still be
// programmatically created via a method of the appropriate CoClass before
// they can be used.
// ************************************************************************ //
// Type Lib: F:\leewei\Delphi5\Book1\ch11\C++CORBA\HelloWorld2\PcoHelloWorld.tlb (1)
// IID\LCID: {C29B5E87-7262-11D3-BCF6-444553540000}\0
// Helpfile:
// DepndLst:
// (1) v2.0 stdole, (C:\CWIN98\SYSTEM\STDOLE2.TLB)
// (2) v4.0 StdVCL, (C:\CWIN98\SYSTEM\STDVCL40.DLL)
// ************************************************************************ //
{$TYPEDADDRESS OFF} // Unit must be compiled without type-checked pointers.
interface
uses Windows, ActiveX, Classes, Graphics, OleServer, OleCtrls, StdVCL, SysUtils, CORBAObj, OrbPas, CorbaStd;
// *********************************************************************//
// GUIDS declared in the TypeLibrary. Following prefixes are used:
// Type Libraries : LIBID_xxxx
// CoClasses : CLASS_xxxx
// DISPInterfaces : DIID_xxxx
// Non-DISP interfaces: IID_xxxx
// *********************************************************************//
const
// TypeLibrary Major and minor versions
PcoHelloWorldMajorVersion = 1;
PcoHelloWorldMinorVersion = 0;
LIBID_PcoHelloWorld: TGUID = '{C29B5E87-7262-11D3-BCF6-444553540000}';
IID_IcoHelloWorld: TGUID = '{C29B5E88-7262-11D3-BCF6-444553540000}';
CLASS_coHelloWorld: TGUID = '{C29B5E8A-7262-11D3-BCF6-444553540000}';
type
// *********************************************************************//
// Forward declaration of types defined in TypeLibrary
// *********************************************************************//
IcoHelloWorld = interface;
IcoHelloWorldDisp = dispinterface;
// *********************************************************************//
// Declaration of CoClasses defined in Type Library
// (NOTE: Here we map each CoClass to its Default Interface)
// *********************************************************************//
coHelloWorld = IcoHelloWorld;
// *********************************************************************//
// Interface: IcoHelloWorld
// Flags: (4416) Dual OleAutomation Dispatchable
// GUID: {C29B5E88-7262-11D3-BCF6-444553540000}
// *********************************************************************//
IcoHelloWorld = interface(IDispatch)
['{C29B5E88-7262-11D3-BCF6-444553540000}']
procedure HelloWorld(vName: OleVariant; var vResult: OleVariant); safecall;
end;
// *********************************************************************//
// DispIntf: IcoHelloWorldDisp
// Flags: (4416) Dual OleAutomation Dispatchable
// GUID: {C29B5E88-7262-11D3-BCF6-444553540000}
// *********************************************************************//
IcoHelloWorldDisp = dispinterface
['{C29B5E88-7262-11D3-BCF6-444553540000}']
procedure HelloWorld(vName: OleVariant; var vResult: OleVariant); dispid 1;
end;
TcoHelloWorldStub = class(TCorbaDispatchStub, IcoHelloWorld)
public
procedure HelloWorld(vName: OleVariant; var vResult: OleVariant); safecall;
end;
TcoHelloWorldSkeleton = class(TCorbaSkeleton)
private
FIntf: IcoHelloWorld;
public
constructor Create(const InstanceName: string; const Impl: IUnknown); override;
procedure GetImplementation(out Impl: IUnknown); override; stdcall;
published
procedure HelloWorld(const InBuf: IMarshalInBuffer; Cookie: Pointer);
end;
// *********************************************************************//
// The Class CocoHelloWorld provides a Create and CreateRemote method to
// create instances of the default interface IcoHelloWorld exposed by
// the CoClass coHelloWorld. The functions are intended to be used by
// clients wishing to automate the CoClass objects exposed by the
// server of this typelibrary.
// *********************************************************************//
CocoHelloWorld = class
class function Create: IcoHelloWorld;
class function CreateRemote(const MachineName: string): IcoHelloWorld;
end;
// *********************************************************************//
// OLE Server Proxy class declaration
// Server Object : TcoHelloWorld
// Help String : coHelloWorld Object
// Default Interface: IcoHelloWorld
// Def. Intf. DISP? : No
// Event Interface:
// TypeFlags : (2) CanCreate
// *********************************************************************//
{$IFDEF LIVE_SERVER_AT_DESIGN_TIME}
TcoHelloWorldProperties= class;
{$ENDIF}
TcoHelloWorld = class(TOleServer)
private
FIntf: IcoHelloWorld;
{$IFDEF LIVE_SERVER_AT_DESIGN_TIME}
FProps: TcoHelloWorldProperties;
function GetServerProperties: TcoHelloWorldProperties;
{$ENDIF}
function GetDefaultInterface: IcoHelloWorld;
protected
procedure InitServerData; override;
public
constructor Create(AOwner: TComponent); override;
destructor Destroy; override;
procedure Connect; override;
procedure ConnectTo(svrIntf: IcoHelloWorld);
procedure Disconnect; override;
procedure HelloWorld(vName: OleVariant; var vResult: OleVariant);
property DefaultInterface: IcoHelloWorld read GetDefaultInterface;
published
{$IFDEF LIVE_SERVER_AT_DESIGN_TIME}
property Server: TcoHelloWorldProperties read GetServerProperties;
{$ENDIF}
end;
{$IFDEF LIVE_SERVER_AT_DESIGN_TIME}
// *********************************************************************//
// OLE Server Properties Proxy Class
// Server Object : TcoHelloWorld
// (This object is used by the IDE's Property Inspector to allow editing
// of the properties of this server)
// *********************************************************************//
TcoHelloWorldProperties = class(TPersistent)
private
FServer: TcoHelloWorld;
function GetDefaultInterface: IcoHelloWorld;
constructor Create(AServer: TcoHelloWorld);
protected
public
property DefaultInterface: IcoHelloWorld read GetDefaultInterface;
published
end;
{$ENDIF}
TcoHelloWorldCorbaFactory = class
class function CreateInstance(const InstanceName: string): IcoHelloWorld;
end;
procedure Register;
implementation
uses ComObj;
{ TcoHelloWorldStub }
procedure TcoHelloWorldStub.HelloWorld(vName: OleVariant; var vResult: OleVariant);
var
OutBuf: IMarshalOutBuffer;
InBuf: IMarshalInBuffer;
begin
FStub.CreateRequest('HelloWorld', True, OutBuf);
MarshalAny(OutBuf, vName);
MarshalAny(OutBuf, vResult);
FStub.Invoke(OutBuf, InBuf);
vResult := UnmarshalAny(InBuf);
end;
{ TcoHelloWorldSkeleton }
constructor TcoHelloWorldSkeleton.Create(const InstanceName: string; const Impl: IUnknown);
begin
inherited;
inherited InitSkeleton('coHelloWorld', InstanceName, 'IDL:PcoHelloWorld/IcoHelloWorld:1.0', tmMultiThreaded, True);
FIntf := Impl as IcoHelloWorld;
end;
procedure TcoHelloWorldSkeleton.GetImplementation(out Impl: IUnknown);
begin
Impl := FIntf;
end;
procedure TcoHelloWorldSkeleton.HelloWorld(const InBuf: IMarshalInBuffer; Cookie: Pointer);
var
OutBuf: IMarshalOutBuffer;
vName: OleVariant;
vResult: OleVariant;
begin
vName := UnmarshalAny(InBuf);
vResult := UnmarshalAny(InBuf);
FIntf.HelloWorld(vName, vResult);
FSkeleton.GetReplyBuffer(Cookie, OutBuf);
MarshalAny(OutBuf, vResult);
end;
class function CocoHelloWorld.Create: IcoHelloWorld;
begin
Result := CreateComObject(CLASS_coHelloWorld) as IcoHelloWorld;
end;
class function CocoHelloWorld.CreateRemote(const MachineName: string): IcoHelloWorld;
begin
Result := CreateRemoteComObject(MachineName, CLASS_coHelloWorld) as IcoHelloWorld;
end;
procedure TcoHelloWorld.InitServerData;
const
CServerData: TServerData = (
ClassID: '{C29B5E8A-7262-11D3-BCF6-444553540000}';
IntfIID: '{C29B5E88-7262-11D3-BCF6-444553540000}';
EventIID: '';
LicenseKey: nil;
Version: 500);
begin
ServerData := @CServerData;
end;
procedure TcoHelloWorld.Connect;
var
punk: IUnknown;
begin
if FIntf = nil then
begin
punk := GetServer;
Fintf:= punk as IcoHelloWorld;
end;
end;
procedure TcoHelloWorld.ConnectTo(svrIntf: IcoHelloWorld);
begin
Disconnect;
FIntf := svrIntf;
end;
procedure TcoHelloWorld.DisConnect;
begin
if Fintf <> nil then
begin
FIntf := nil;
end;
end;
function TcoHelloWorld.GetDefaultInterface: IcoHelloWorld;
begin
if FIntf = nil then
Connect;
Assert(FIntf <> nil, 'DefaultInterface is NULL. Component is not connected to Server. You must call ''Connect'' or ''ConnectTo'' before this operation');
Result := FIntf;
end;
constructor TcoHelloWorld.Create(AOwner: TComponent);
begin
inherited Create(AOwner);
{$IFDEF LIVE_SERVER_AT_DESIGN_TIME}
FProps := TcoHelloWorldProperties.Create(Self);
{$ENDIF}
end;
destructor TcoHelloWorld.Destroy;
begin
{$IFDEF LIVE_SERVER_AT_DESIGN_TIME}
FProps.Free;
{$ENDIF}
inherited Destroy;
end;
{$IFDEF LIVE_SERVER_AT_DESIGN_TIME}
function TcoHelloWorld.GetServerProperties: TcoHelloWorldProperties;
begin
Result := FProps;
end;
{$ENDIF}
procedure TcoHelloWorld.HelloWorld(vName: OleVariant; var vResult: OleVariant);
begin
DefaultInterface.HelloWorld(vName, vResult);
end;
{$IFDEF LIVE_SERVER_AT_DESIGN_TIME}
constructor TcoHelloWorldProperties.Create(AServer: TcoHelloWorld);
begin
inherited Create;
FServer := AServer;
end;
function TcoHelloWorldProperties.GetDefaultInterface: IcoHelloWorld;
begin
Result := FServer.DefaultInterface;
end;
{$ENDIF}
class function TcoHelloWorldCorbaFactory.CreateInstance(const InstanceName: string): IcoHelloWorld;
begin
Result := CorbaFactoryCreateStub('IDL:PcoHelloWorld/coHelloWorldFactory:1.0', 'coHelloWorld',
InstanceName, '', IcoHelloWorld) as IcoHelloWorld;
end;
procedure Register;
begin
RegisterComponents('Servers',[TcoHelloWorld]);
end;
initialization
CorbaStubManager.RegisterStub(IcoHelloWorld, TcoHelloWorldStub);
CorbaInterfaceIDManager.RegisterInterface(IcoHelloWorld, 'IDL:PcoHelloWorld/IcoHelloWorld:1.0');
CorbaSkeletonManager.RegisterSkeleton(IcoHelloWorld, TcoHelloWorldSkeleton);
end.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -