Marco Web Center |
|
Chapter 20 - Project MdComEvents |
Project Structure |
MdComEvents.dpr |
library MdComEvents; uses ComServ, ComObj, MdComEvents_TLB in 'MdComEvents_TLB.pas'; exports DllGetClassObject, DllCanUnloadNow, DllRegisterServer, DllUnregisterServer; {$R *.TLB} {$R *.RES} type // fake abstract class TMdInform = class (TAutoObject, IMdInform) protected procedure Informs(Code: Integer; const Message: WideString); virtual; safecall; abstract; end; begin TAutoObjectFactory.Create(ComServer, TMdInform, Class_MdInform, ciMultiInstance, tmApartment); end. |
MdComEvents_TLB.pas |
unit MdComEvents_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.118 $ // File generated on 4/28/2001 4:54:54 PM from Type Library described below. // ************************************************************************ // // Type Lib: C:\md6code\20\MdComEvents\MdComEvents.dll (2) // LIBID: {F4A80A55-914B-49EF-93B1-B42EE5E37711} // LCID: 0 // Helpfile: // DepndLst: // (1) v2.0 stdole, (C:\WINDOWS\System32\stdole2.tlb) // Parent TypeLibrary: // (0) v1.0 EvtSubscriber, (C:\md6code\20\MdComEvents\EvtSubscriber.tlb) // ************************************************************************ // {$TYPEDADDRESS OFF} // Unit must be compiled without type-checked pointers. {$WARN SYMBOL_PLATFORM OFF} {$WRITEABLECONST ON} interface uses ActiveX, Classes, Graphics, StdVcl, Variants, Windows; // *********************************************************************// // 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 MdComEventsMajorVersion = 1; MdComEventsMinorVersion = 0; LIBID_MdComEvents: TGUID = '{F4A80A55-914B-49EF-93B1-B42EE5E37711}'; IID_IMdInform: TGUID = '{202D2CC8-8E6C-4E96-9C14-1FAAE3920ECC}'; CLASS_MdInform: TGUID = '{0C7A44A5-CC67-4B97-9051-BFE92328EB6B}'; type // *********************************************************************// // Forward declaration of types defined in TypeLibrary // *********************************************************************// IMdInform = interface; IMdInformDisp = dispinterface; // *********************************************************************// // Declaration of CoClasses defined in Type Library // (NOTE: Here we map each CoClass to its Default Interface) // *********************************************************************// MdInform = IMdInform; // *********************************************************************// // Interface: IMdInform // Flags: (4416) Dual OleAutomation Dispatchable // GUID: {202D2CC8-8E6C-4E96-9C14-1FAAE3920ECC} // *********************************************************************// IMdInform = interface(IDispatch) ['{202D2CC8-8E6C-4E96-9C14-1FAAE3920ECC}'] procedure Informs(Code: Integer; const Message: WideString); safecall; end; // *********************************************************************// // DispIntf: IMdInformDisp // Flags: (4416) Dual OleAutomation Dispatchable // GUID: {202D2CC8-8E6C-4E96-9C14-1FAAE3920ECC} // *********************************************************************// IMdInformDisp = dispinterface ['{202D2CC8-8E6C-4E96-9C14-1FAAE3920ECC}'] procedure Informs(Code: Integer; const Message: WideString); dispid 1; end; // *********************************************************************// // The Class CoMdInform provides a Create and CreateRemote method to // create instances of the default interface IMdInform exposed by // the CoClass MdInform. The functions are intended to be used by // clients wishing to automate the CoClass objects exposed by the // server of this typelibrary. // *********************************************************************// CoMdInform = class class function Create: IMdInform; class function CreateRemote(const MachineName: string): IMdInform; end; implementation uses ComObj; class function CoMdInform.Create: IMdInform; begin Result := CreateComObject(CLASS_MdInform) as IMdInform; end; class function CoMdInform.CreateRemote(const MachineName: string): IMdInform; begin Result := CreateRemoteComObject(MachineName, CLASS_MdInform) as IMdInform; end; end. |