Marco Web Center |
Home: Code Repository: Mastering Delphi 5Project FIRSTCOM
Project StructureFIRSTCOM.DPRlibrary FirstCom; uses ComServ, NumIntf in 'NumIntf.pas', NumServ in 'NumServ.pas', FirstCom_TLB in 'FirstCom_TLB.pas'; exports DllGetClassObject, DllCanUnloadNow, DllRegisterServer, DllUnregisterServer; {$R *.TLB} {$R *.RES} begin end. NUMINTF.PASunit NumIntf; interface type INumber = interface ['{B4131140-7C2F-11D0-98D0-444553540000}'] function GetValue: Integer; stdcall; procedure SetValue (New: Integer); stdcall; procedure Increase; stdcall; end; implementation end. NUMSERV.PASunit NumServ; interface uses Windows, ActiveX, ComObj, NumIntf; type TNumber = class(TComObject, INumber) private fValue: Integer; public function GetValue: Integer; virtual; stdcall; procedure SetValue (New: Integer); virtual; stdcall; procedure Increase; virtual; stdcall; procedure Initialize; override; destructor Destroy; override; end; const Class_Number: TGUID = '{5B2EF181-3AAE-11D3-B9F1-00000100A27B}'; implementation uses ComServ; { TNumber } destructor TNumber.Destroy; begin inherited; MessageBox (0, 'Object Destroyed', 'TDLLNumber', mb_OK); // API call end; function TNumber.GetValue: Integer; begin Result := fValue; end; procedure TNumber.Increase; begin Inc (fValue); end; procedure TNumber.Initialize; begin inherited; fValue := 10; end; procedure TNumber.SetValue(New: Integer); begin fValue := New; end; initialization TComObjectFactory.Create(ComServer, TNumber, Class_Number, 'Number', 'Number Server', ciMultiInstance, tmApartment); end. FIRSTCOM_TLB.PASunit FirstCom_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.79 $ // File generated on 7/15/99 3:08:11 PM from Type Library described below. // ************************************************************************ // // Type Lib: C:\md5code\Part4\15\FirstCom\FirstCom.tlb (1) // IID\LCID: {5B2EF182-3AAE-11D3-B9F1-00000100A27B}\0 // Helpfile: // DepndLst: // (1) v2.0 stdole, (C:\WINDOWS\SYSTEM\STDOLE2.TLB) // (2) v4.0 StdVCL, (C:\WINDOWS\SYSTEM\STDVCL40.DLL) // ************************************************************************ // interface uses Windows, ActiveX, Classes, Graphics, OleServer, OleCtrls, StdVCL; // *********************************************************************// // 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 FirstComMajorVersion = 1; FirstComMinorVersion = 0; LIBID_FirstCom: TGUID = '{5B2EF182-3AAE-11D3-B9F1-00000100A27B}'; implementation uses ComObj; end.
|
||
© Copyright Marco Cantù, 1995-2020, All rights reserved |