调用服务端函数报错(100)

  • 主题发起人 主题发起人 liuguilg
  • 开始时间 开始时间
L

liuguilg

Unregistered / Unconfirmed
GUEST, unregistred user!
在客户端使用时出现method 'Judge' not supported by automation object的错误.服务端代码unit UnitRemoteModule;{$WARN SYMBOL_PLATFORM OFF}interfaceuses Windows, Messages, SysUtils, Classes, ComServ, ComObj, VCLCom, DataBkr, DBClient, Server_A_TLB, StdVcl, Provider, DB, ADODB;type TCom_A = class(TRemoteDataModule, ICom_A) ADOConnection1: TADOConnection;
DataSetProvider1: TDataSetProvider;
ADOQuery1: TADOQuery;
private { Private declarations } protected class procedure UpdateRegistry(Register: Boolean;
const ClassID, ProgID: string);
override;
function Judge(v_str:string):integer;
public { Public declarations } end;
implementation{$R *.DFM}function TCom_A.Judge(v_str: string): integer;var var_str:string;
begin
var_str := v_str;
if var_str='123456' then
result := 1 else
result := 0 ;
end;
class procedure TCom_A.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;
initialization TComponentFactory.Create(ComServer, TCom_A, Class_Com_A, ciMultiInstance, tmApartment);
end.
-----------------------------------客户端调用:procedure TForm1.Button3Click(Sender: TObject);var n:integer ;
begin
n := Socket.AppServer.Judge('123456');
//运行这里报错 if n=1 then
edit2.Text := 'Yes';
if n=0 then
edit2.Text := 'No';
end;
 
后退
顶部