Project: SimpleServer.dproj |
Project Structure |
|
SimpleServer.dpr |
library SimpleServer;
uses
ComServ,
SimpleServer_TLB in 'SimpleServer_TLB.pas',
NumImpl in 'NumImpl.pas';
exports
DllGetClassObject,
DllCanUnloadNow,
DllRegisterServer,
DllUnregisterServer;
{$R *.TLB}
{$R *.RES}
begin
end. |
SimpleServer_TLB.pas |
unit SimpleServer_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.
// ************************************************************************ //
// $Rev: 17252 $
// File generated on 11/4/2008 12:12:33 AM from Type Library described below.
// ************************************************************************ //
// Type Lib: C:\Users\Marco\Documents\books2008\tiburon\sourcecode\08\SimpleServer\SimpleServer (1)
// LIBID: {6D563F05-A924-4C69-91EB-FAC149485901}
// LCID: 0
// Helpfile:
// HelpString: SimpleServer Library
// DepndLst:
// (1) v2.0 stdole, (C:\Windows\system32\stdole2.tlb)
// ************************************************************************ //
{$TYPEDADDRESS OFF} // Unit must be compiled without type-checked pointers.
{$WARN SYMBOL_PLATFORM OFF}
{$WRITEABLECONST ON}
{$VARPROPSETTER ON}
{$ALIGN 4}
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
SimpleServerMajorVersion = 1;
SimpleServerMinorVersion = 0;
LIBID_SimpleServer: TGUID = '{6D563F05-A924-4C69-91EB-FAC149485901}';
IID_INumberProp: TGUID = '{4D24B32A-DE61-4EBE-AE53-6DF2D3DC80DA}';
CLASS_NumberProp: TGUID = '{BDC9A273-A973-4DB4-ADE7-8F0A49004D29}';
type
// *********************************************************************//
// Forward declaration of types defined in TypeLibrary
// *********************************************************************//
INumberProp = interface;
// *********************************************************************//
// Declaration of CoClasses defined in Type Library
// (NOTE: Here we map each CoClass to its Default Interface)
// *********************************************************************//
NumberProp = INumberProp;
// *********************************************************************//
// Interface: INumberProp
// Flags: (256) OleAutomation
// GUID: {4D24B32A-DE61-4EBE-AE53-6DF2D3DC80DA}
// *********************************************************************//
INumberProp = interface(IUnknown)
['{4D24B32A-DE61-4EBE-AE53-6DF2D3DC80DA}']
function Get_Value: Integer; safecall;
procedure Set_Value(New: Integer); safecall;
procedure Increase; safecall;
property Value: Integer read Get_Value write Set_Value;
end;
// *********************************************************************//
// The Class CoNumberProp provides a Create and CreateRemote method to
// create instances of the default interface INumberProp exposed by
// the CoClass NumberProp. The functions are intended to be used by
// clients wishing to automate the CoClass objects exposed by the
// server of this typelibrary.
// *********************************************************************//
CoNumberProp = class
class function Create: INumberProp;
class function CreateRemote(const MachineName: string): INumberProp;
end;
implementation
uses ComObj;
class function CoNumberProp.Create: INumberProp;
begin
Result := CreateComObject(CLASS_NumberProp) as INumberProp;
end;
class function CoNumberProp.CreateRemote(const MachineName: string): INumberProp;
begin
Result := CreateRemoteComObject(MachineName, CLASS_NumberProp) as INumberProp;
end;
end. |
NumImpl.pas |
unit NumImpl;
interface
uses
Windows, ActiveX, Classes, ComObj, SimpleServer_TLB, StdVcl;
type
TNumberProp = class(TTypedComObject, INumberProp)
private
fValue: Integer;
public
procedure Initialize; override;
destructor Destroy; override;
procedure Increase; safecall;
function Get_Value: Integer; safecall;
procedure Set_Value(New: Integer); safecall;
end;
implementation
uses ComServ;
destructor TNumberProp.Destroy;
begin
MessageBox (0, 'Object Destroyed',
'TNumberProp', mb_OK); // API call
inherited;
end;
function TNumberProp.Get_Value: Integer;
begin
Result := fValue
end;
procedure TNumberProp.Increase;
begin
Inc (fValue)
end;
procedure TNumberProp.Initialize;
begin
inherited;
fValue := 10
end;
procedure TNumberProp.Set_Value(New: Integer);
begin
fValue := New
end;
initialization
TTypedComObjectFactory.Create(ComServer, TNumberProp, Class_NumberProp,
ciMultiInstance, tmApartment);
end. |
SimpleServer.ridl |
// ************************************************************************ //
// WARNING
// -------
// This file is generated by the Type Library importer or Type Libary Editor.
// Barring syntax errors, the Editor will parse modifications made to the file.
// However, when applying changes via the Editor this file will be regenerated
// and comments or formatting changes will be lost.
// ************************************************************************ //
// File generated on 11/4/2008 12:11:00 AM (- $Rev: 12980 $, 11798308).
[
uuid(6D563F05-A924-4C69-91EB-FAC149485901),
version(1.0),
helpstring("SimpleServer Library")
]
library SimpleServer
{
importlib("stdole2.tlb");
interface INumberProp;
coclass NumberProp;
[
uuid(4D24B32A-DE61-4EBE-AE53-6DF2D3DC80DA),
version(1.0),
helpstring("Interface for NumberProp Object"),
oleautomation
]
interface INumberProp: IUnknown
{
[propget, id(0x00000065)]
HRESULT _stdcall Value([out, retval] long* New);
[propput, id(0x00000065)]
HRESULT _stdcall Value([in] long New);
[id(0x00000066)]
HRESULT _stdcall Increase(void);
};
[
uuid(BDC9A273-A973-4DB4-ADE7-8F0A49004D29),
version(1.0),
helpstring("NumberProp")
]
coclass NumberProp
{
[default] interface INumberProp;
};
}; |
HTML file generated by PasToWeb, a tool by Marco Cantù
Copyright 2008 Marco Cantù |
|