Y
yeath
Unregistered / Unconfirmed
GUEST, unregistred user!
远程数据模块代码如下(Unit2):
type
TEasyDcomServer = class(TRemoteDataModule, IEasyDcomServer)
DSP_A: TDataSetProvider;
private
CallBackTemp:OleVariant;
{ Private declarations }
protected
class procedure UpdateRegistry(Register: Boolean;
const ClassID, ProgID: string);
override;
procedure Connect(vClient: OleVariant);
safecall;
public
procedure SendMsg(sMsg:WideString);
{ Public declarations }
end;
implementation
uses Unit1, ComCtrls;
{$R *.DFM}
class procedure TEasyDcomServer.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 TEasyDcomServer.Connect(vClient: OleVariant);
begin
Form1.mdata := self;
CallBackTemp := vClient;
end;
procedure TEasyDcomServer.SendMsg(sMsg: WideString);
begin
CallBackTemp.OnText(sMsg);
end;
initialization
TComponentFactory.Create(ComServer, TEasyDcomServer,
Class_EasyDcomServer, ciMultiInstance, tmApartment);
end.
type
TEasyDcomServer = class(TRemoteDataModule, IEasyDcomServer)
DSP_A: TDataSetProvider;
private
CallBackTemp:OleVariant;
{ Private declarations }
protected
class procedure UpdateRegistry(Register: Boolean;
const ClassID, ProgID: string);
override;
procedure Connect(vClient: OleVariant);
safecall;
public
procedure SendMsg(sMsg:WideString);
{ Public declarations }
end;
implementation
uses Unit1, ComCtrls;
{$R *.DFM}
class procedure TEasyDcomServer.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 TEasyDcomServer.Connect(vClient: OleVariant);
begin
Form1.mdata := self;
CallBackTemp := vClient;
end;
procedure TEasyDcomServer.SendMsg(sMsg: WideString);
begin
CallBackTemp.OnText(sMsg);
end;
initialization
TComponentFactory.Create(ComServer, TEasyDcomServer,
Class_EasyDcomServer, ciMultiInstance, tmApartment);
end.