ServerRDM.pas
上传用户:psxgmh
上传日期:2013-04-08
资源大小:15112k
文件大小:2k
- unit ServerRDM;
- {$WARN SYMBOL_PLATFORM OFF}
- interface
- uses
- Windows, Messages, SysUtils, Classes, ComServ, ComObj, VCLCom, DataBkr,
- DBClient, Server_TLB, StdVcl, Provider, DB, DBTables;
- type
- TCorrectServer = class(TRemoteDataModule, ICorrectServer)
- Table1: TTable;
- DataSetProvider1: TDataSetProvider;
- private
- { Private declarations }
- protected
- class procedure UpdateRegistry(Register: Boolean; const ClassID, ProgID: string); override;
- procedure GetServerName(var vName: OleVariant); safecall;
- procedure GetSystemTime(var vTime: OleVariant); safecall;
- public
- { Public declarations }
- end;
- implementation
- {$R *.DFM}
- class procedure TCorrectServer.UpdateRegistry(Register: Boolean; const ClassID, ProgID: string);
- begin
- if Register then
- begin
- inherited UpdateRegistry(Register, ClassID, ProgID);
- EnableSocketTransport(ClassID);
- EnableWebTransport(ClassID);
- end else
- begin
- DisableSocketTransport(ClassID);
- DisableWebTransport(ClassID);
- inherited UpdateRegistry(Register, ClassID, ProgID);
- end;
- end;
- //得到服务器的名称
- procedure TCorrectServer.GetServerName(var vName: OleVariant);
- var
- aComputerName : PChar;
- aSize :cardinal;
- begin
- GetComputerName(aComputerName,aSize);
- vName := string(aComputerName);
- end;
- //得到服务器的时间
- procedure TCorrectServer.GetSystemTime(var vTime: OleVariant);
- begin
- vTime := DateToStr(Now);
- end;
- initialization
- TComponentFactory.Create(ComServer, TCorrectServer,
- Class_CorrectServer, ciMultiInstance, tmApartment);
- end.