home *** CD-ROM | disk | FTP | other *** search
Wrap
unit Browser_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 1/2/00 6:20:35 PM 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: D:\CODE\DELPHI\BROWSER5\Browser.tlb (1) // IID\LCID: {70B65734-F8D2-11D2-A0ED-000000000000}\0 // Helpfile: // DepndLst: // (1) v2.0 stdole, (C:\WINDOWS\SYSTEM\STDOLE2.TLB) // (2) v4.0 StdVCL, (C:\WINDOWS\SYSTEM\STDVCL40.DLL) // ************************************************************************ // {$TYPEDADDRESS OFF} // Unit must be compiled without type-checked pointers. 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 BrowserMajorVersion = 1; BrowserMinorVersion = 0; LIBID_Browser: TGUID = '{70B65734-F8D2-11D2-A0ED-000000000000}'; IID_ICOMBrowser: TGUID = '{70B65735-F8D2-11D2-A0ED-000000000000}'; CLASS_COMBrowser: TGUID = '{70B65737-F8D2-11D2-A0ED-000000000000}'; type // *********************************************************************// // Forward declaration of types defined in TypeLibrary // *********************************************************************// ICOMBrowser = interface; // *********************************************************************// // Declaration of CoClasses defined in Type Library // (NOTE: Here we map each CoClass to its Default Interface) // *********************************************************************// COMBrowser = ICOMBrowser; // *********************************************************************// // Interface: ICOMBrowser // Flags: (0) // GUID: {70B65735-F8D2-11D2-A0ED-000000000000} // *********************************************************************// ICOMBrowser = interface(IUnknown) ['{70B65735-F8D2-11D2-A0ED-000000000000}'] end; // *********************************************************************// // The Class CoCOMBrowser provides a Create and CreateRemote method to // create instances of the default interface ICOMBrowser exposed by // the CoClass COMBrowser. The functions are intended to be used by // clients wishing to automate the CoClass objects exposed by the // server of this typelibrary. // *********************************************************************// CoCOMBrowser = class class function Create: ICOMBrowser; class function CreateRemote(const MachineName: string): ICOMBrowser; end; // *********************************************************************// // OLE Server Proxy class declaration // Server Object : TCOMBrowser // Help String : COMBrowser Object // Default Interface: ICOMBrowser // Def. Intf. DISP? : No // Event Interface: // TypeFlags : (2) CanCreate // *********************************************************************// {$IFDEF LIVE_SERVER_AT_DESIGN_TIME} TCOMBrowserProperties= class; {$ENDIF} TCOMBrowser = class(TOleServer) private FIntf: ICOMBrowser; {$IFDEF LIVE_SERVER_AT_DESIGN_TIME} FProps: TCOMBrowserProperties; function GetServerProperties: TCOMBrowserProperties; {$ENDIF} function GetDefaultInterface: ICOMBrowser; protected procedure InitServerData; override; public constructor Create(AOwner: TComponent); override; destructor Destroy; override; procedure Connect; override; procedure ConnectTo(svrIntf: ICOMBrowser); procedure Disconnect; override; property DefaultInterface: ICOMBrowser read GetDefaultInterface; published {$IFDEF LIVE_SERVER_AT_DESIGN_TIME} property Server: TCOMBrowserProperties read GetServerProperties; {$ENDIF} end; {$IFDEF LIVE_SERVER_AT_DESIGN_TIME} // *********************************************************************// // OLE Server Properties Proxy Class // Server Object : TCOMBrowser // (This object is used by the IDE's Property Inspector to allow editing // of the properties of this server) // *********************************************************************// TCOMBrowserProperties = class(TPersistent) private FServer: TCOMBrowser; function GetDefaultInterface: ICOMBrowser; constructor Create(AServer: TCOMBrowser); protected public property DefaultInterface: ICOMBrowser read GetDefaultInterface; published end; {$ENDIF} procedure Register; implementation uses ComObj; class function CoCOMBrowser.Create: ICOMBrowser; begin Result := CreateComObject(CLASS_COMBrowser) as ICOMBrowser; end; class function CoCOMBrowser.CreateRemote(const MachineName: string): ICOMBrowser; begin Result := CreateRemoteComObject(MachineName, CLASS_COMBrowser) as ICOMBrowser; end; procedure TCOMBrowser.InitServerData; const CServerData: TServerData = ( ClassID: '{70B65737-F8D2-11D2-A0ED-000000000000}'; IntfIID: '{70B65735-F8D2-11D2-A0ED-000000000000}'; EventIID: ''; LicenseKey: nil; Version: 500); begin ServerData := @CServerData; end; procedure TCOMBrowser.Connect; var punk: IUnknown; begin if FIntf = nil then begin punk := GetServer; Fintf:= punk as ICOMBrowser; end; end; procedure TCOMBrowser.ConnectTo(svrIntf: ICOMBrowser); begin Disconnect; FIntf := svrIntf; end; procedure TCOMBrowser.DisConnect; begin if Fintf <> nil then begin FIntf := nil; end; end; function TCOMBrowser.GetDefaultInterface: ICOMBrowser; 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 TCOMBrowser.Create(AOwner: TComponent); begin inherited Create(AOwner); {$IFDEF LIVE_SERVER_AT_DESIGN_TIME} FProps := TCOMBrowserProperties.Create(Self); {$ENDIF} end; destructor TCOMBrowser.Destroy; begin {$IFDEF LIVE_SERVER_AT_DESIGN_TIME} FProps.Free; {$ENDIF} inherited Destroy; end; {$IFDEF LIVE_SERVER_AT_DESIGN_TIME} function TCOMBrowser.GetServerProperties: TCOMBrowserProperties; begin Result := FProps; end; {$ENDIF} {$IFDEF LIVE_SERVER_AT_DESIGN_TIME} constructor TCOMBrowserProperties.Create(AServer: TCOMBrowser); begin inherited Create; FServer := AServer; end; function TCOMBrowserProperties.GetDefaultInterface: ICOMBrowser; begin Result := FServer.DefaultInterface; end; {$ENDIF} procedure Register; begin RegisterComponents('Servers',[TCOMBrowser]); end; end.