unit Mark_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 : 1.2
// File generated on 06.10.2006 12:34:43 from Type Library described below.
// ************************************************************************ //
// Type Lib: N:\develop\Mark V 2.00 Beta 5\Compiled\Mark.exe (1)
// LIBID: {31B21198-0674-4E92-A530-30733A0FF68F}
// LCID: 0
// Helpfile:
// HelpString: Mark Bibliothek
// DepndLst:
// (1) v2.0 stdole, (C:\WINDOWS\system32\STDOLE2.TLB)
// ************************************************************************ //
// *************************************************************************//
// 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.
{$TYPEDADDRESS OFF} // Unit must be compiled without type-checked pointers.
{$WARN SYMBOL_PLATFORM OFF}
{$WRITEABLECONST ON}
{$VARPROPSETTER ON}
interface
uses Windows,
ActiveX, Classes, Graphics, OleServer, StdVCL, Variants;
// *********************************************************************//
// 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
MarkMajorVersion = 1;
MarkMinorVersion = 0;
LIBID_Mark: TGUID = '
{31B21198-0674-4E92-A530-30733A0FF68F}';
IID_IRemoteInterface: TGUID = '
{0F24B5BF-F5B6-4F0D-9E0D-0FAB63EE4D88}';
DIID_IRemoteInterfaceEvents: TGUID = '
{7B013F03-6B4C-48B4-8B1B-D20EDCCE5298}';
CLASS_RemoteInterface: TGUID = '
{77CB394B-79AC-43A6-B492-4BA10126E3ED}';
type
// *********************************************************************//
// Forward declaration of types defined in TypeLibrary
// *********************************************************************//
IRemoteInterface =
interface;
IRemoteInterfaceDisp =
dispinterface;
IRemoteInterfaceEvents =
dispinterface;
// *********************************************************************//
// Declaration of CoClasses defined in Type Library
// (NOTE: Here we map each CoClass to its Default Interface)
// *********************************************************************//
RemoteInterface = IRemoteInterface;
// *********************************************************************//
// Interface: IRemoteInterface
// Flags: (4416) Dual OleAutomation Dispatchable
// GUID: {0F24B5BF-F5B6-4F0D-9E0D-0FAB63EE4D88}
// *********************************************************************//
IRemoteInterface =
interface(IDispatch)
['
{0F24B5BF-F5B6-4F0D-9E0D-0FAB63EE4D88}']
function DoCommand(Cmd: Integer; Params: OleVariant;
var Data: OleVariant): Integer;
safecall;
end;
// *********************************************************************//
// DispIntf: IRemoteInterfaceDisp
// Flags: (4416) Dual OleAutomation Dispatchable
// GUID: {0F24B5BF-F5B6-4F0D-9E0D-0FAB63EE4D88}
// *********************************************************************//
IRemoteInterfaceDisp =
dispinterface
['
{0F24B5BF-F5B6-4F0D-9E0D-0FAB63EE4D88}']
function DoCommand(Cmd: Integer; Params: OleVariant;
var Data: OleVariant): Integer;
dispid 201;
end;
// *********************************************************************//
// DispIntf: IRemoteInterfaceEvents
// Flags: (4096) Dispatchable
// GUID: {7B013F03-6B4C-48B4-8B1B-D20EDCCE5298}
// *********************************************************************//
IRemoteInterfaceEvents =
dispinterface
['
{7B013F03-6B4C-48B4-8B1B-D20EDCCE5298}']
procedure OnMessage(
const MessageText: WideString);
dispid 201;
end;
// *********************************************************************//
// The Class CoRemoteInterface provides a Create and CreateRemote method to
// create instances of the default interface IRemoteInterface exposed by
// the CoClass RemoteInterface. The functions are intended to be used by
// clients wishing to automate the CoClass objects exposed by the
// server of this typelibrary.
// *********************************************************************//
CoRemoteInterface =
class
class function Create: IRemoteInterface;
class function CreateRemote(
const MachineName:
string): IRemoteInterface;
end;
TRemoteInterfaceOnMessage =
procedure(ASender: TObject;
const MessageText: WideString)
of object;
// *********************************************************************//
// OLE Server Proxy class declaration
// Server Object : TRemoteInterface
// Help String : RemoteInterface Objekt
// Default Interface: IRemoteInterface
// Def. Intf. DISP? : No
// Event Interface: IRemoteInterfaceEvents
// TypeFlags : (2) CanCreate
// *********************************************************************//
{$IFDEF LIVE_SERVER_AT_DESIGN_TIME}
TRemoteInterfaceProperties=
class;
{$ENDIF}
TRemoteInterface =
class(TOleServer)
private
FOnMessage: TRemoteInterfaceOnMessage;
FIntf: IRemoteInterface;
{$IFDEF LIVE_SERVER_AT_DESIGN_TIME}
FProps: TRemoteInterfaceProperties;
function GetServerProperties: TRemoteInterfaceProperties;
{$ENDIF}
function GetDefaultInterface: IRemoteInterface;
protected
procedure InitServerData;
override;
procedure InvokeEvent(
DispID: TDispID;
var Params: TVariantArray);
override;
public
constructor Create(AOwner: TComponent);
override;
destructor Destroy;
override;
procedure Connect;
override;
procedure ConnectTo(svrIntf: IRemoteInterface);
procedure Disconnect;
override;
function DoCommand(Cmd: Integer; Params: OleVariant;
var Data: OleVariant): Integer;
property DefaultInterface: IRemoteInterface
read GetDefaultInterface;
published
{$IFDEF LIVE_SERVER_AT_DESIGN_TIME}
property Server: TRemoteInterfaceProperties
read GetServerProperties;
{$ENDIF}
property OnMessage: TRemoteInterfaceOnMessage
read FOnMessage
write FOnMessage;
end;
{$IFDEF LIVE_SERVER_AT_DESIGN_TIME}
// *********************************************************************//
// OLE Server Properties Proxy Class
// Server Object : TRemoteInterface
// (This object is used by the IDE's Property Inspector to allow editing
// of the properties of this server)
// *********************************************************************//
TRemoteInterfaceProperties =
class(TPersistent)
private
FServer: TRemoteInterface;
function GetDefaultInterface: IRemoteInterface;
constructor Create(AServer: TRemoteInterface);
protected
public
property DefaultInterface: IRemoteInterface
read GetDefaultInterface;
published
end;
{$ENDIF}
procedure Register;
resourcestring
dtlServerPage = '
Additional';
dtlOcxPage = '
Additional';
implementation
uses ComObj;
class function CoRemoteInterface.Create: IRemoteInterface;
begin
Result := CreateComObject(CLASS_RemoteInterface)
as IRemoteInterface;
end;
class function CoRemoteInterface.CreateRemote(
const MachineName:
string): IRemoteInterface;
begin
Result := CreateRemoteComObject(MachineName, CLASS_RemoteInterface)
as IRemoteInterface;
end;
procedure TRemoteInterface.InitServerData;
const
CServerData: TServerData = (
ClassID: '
{77CB394B-79AC-43A6-B492-4BA10126E3ED}';
IntfIID: '
{0F24B5BF-F5B6-4F0D-9E0D-0FAB63EE4D88}';
EventIID: '
{7B013F03-6B4C-48B4-8B1B-D20EDCCE5298}';
LicenseKey:
nil;
Version: 500);
begin
ServerData := @CServerData;
end;
procedure TRemoteInterface.Connect;
var
punk: IUnknown;
begin
if FIntf =
nil then
begin
punk := GetServer;
ConnectEvents(punk);
Fintf:= punk
as IRemoteInterface;
end;
end;
procedure TRemoteInterface.ConnectTo(svrIntf: IRemoteInterface);
begin
Disconnect;
FIntf := svrIntf;
ConnectEvents(FIntf);
end;
procedure TRemoteInterface.DisConnect;
begin
if Fintf <>
nil then
begin
DisconnectEvents(FIntf);
FIntf :=
nil;
end;
end;
function TRemoteInterface.GetDefaultInterface: IRemoteInterface;
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 TRemoteInterface.Create(AOwner: TComponent);
begin
inherited Create(AOwner);
{$IFDEF LIVE_SERVER_AT_DESIGN_TIME}
FProps := TRemoteInterfaceProperties.Create(Self);
{$ENDIF}
end;
destructor TRemoteInterface.Destroy;
begin
{$IFDEF LIVE_SERVER_AT_DESIGN_TIME}
FProps.Free;
{$ENDIF}
inherited Destroy;
end;
{$IFDEF LIVE_SERVER_AT_DESIGN_TIME}
function TRemoteInterface.GetServerProperties: TRemoteInterfaceProperties;
begin
Result := FProps;
end;
{$ENDIF}
procedure TRemoteInterface.InvokeEvent(
DispID: TDispID;
var Params: TVariantArray);
begin
case DispID of
-1: Exit;
// DISPID_UNKNOWN
201:
if Assigned(FOnMessage)
then
FOnMessage(Self, Params[0]
{const WideString});
end;
{case DispID}
end;
function TRemoteInterface.DoCommand(Cmd: Integer; Params: OleVariant;
var Data: OleVariant): Integer;
begin
Result := DefaultInterface.DoCommand(Cmd, Params, Data);
end;
{$IFDEF LIVE_SERVER_AT_DESIGN_TIME}
constructor TRemoteInterfaceProperties.Create(AServer: TRemoteInterface);
begin
inherited Create;
FServer := AServer;
end;
function TRemoteInterfaceProperties.GetDefaultInterface: IRemoteInterface;
begin
Result := FServer.DefaultInterface;
end;
{$ENDIF}
procedure Register;
begin
RegisterComponents(dtlServerPage, [TRemoteInterface]);
end;
end.