H
hn_chx
Unregistered / Unconfirmed
GUEST, unregistred user!
本人自己声明了一个gprscommunication类
type
Tgprscommunicate =class
UDP: TNMUDP;
procedure UDPDataReceived(Sender:TComponent;NumberBytes:Integer;FromIP:String;Port:Integer);
private
{ Private declarations }
public
{ Public declarations }
function UDP_register(ip:string;port:integer;rcubh:string;delayint:integer):boolean;
end;
function Tgprscommunicate.UDP_register(ip:string;port:integer;rcubh:string;delayint:integer):boolean;
var
UDP_send:string;
SStream:TMemorystream;
begin
result:=false;
UDP.ReportLevel :=STATUS_BASIC;
UDP.RemoteHost:=ip;
UDP.RemotePort:=port;
Sstream:=TMemorystream.Create ;
try
SStream.Write(UDP_send[1],length(UDP_send));
UDP.SendStream (sstream);
finally
SStream.Free ;
end;
end;
程序运行时访问UDP的属性reportlevel、remotehost、remodeport时会出错
‘Access violation at address 0055f3f8 in module 'remotereadmeters.exe'....’
请问难道自己声明的类中不能包含别TNMUDP、TIMER吗?
type
Tgprscommunicate =class
UDP: TNMUDP;
procedure UDPDataReceived(Sender:TComponent;NumberBytes:Integer;FromIP:String;Port:Integer);
private
{ Private declarations }
public
{ Public declarations }
function UDP_register(ip:string;port:integer;rcubh:string;delayint:integer):boolean;
end;
function Tgprscommunicate.UDP_register(ip:string;port:integer;rcubh:string;delayint:integer):boolean;
var
UDP_send:string;
SStream:TMemorystream;
begin
result:=false;
UDP.ReportLevel :=STATUS_BASIC;
UDP.RemoteHost:=ip;
UDP.RemotePort:=port;
Sstream:=TMemorystream.Create ;
try
SStream.Write(UDP_send[1],length(UDP_send));
UDP.SendStream (sstream);
finally
SStream.Free ;
end;
end;
程序运行时访问UDP的属性reportlevel、remotehost、remodeport时会出错
‘Access violation at address 0055f3f8 in module 'remotereadmeters.exe'....’
请问难道自己声明的类中不能包含别TNMUDP、TIMER吗?