你是否正在寻找关于eaccessviolation的内容?让我把最棒的东西奉献给你:
当前位置:我的异常网» Delphi»Delphi7检测到异常类 eaccessviolation,异常信息:'A
Delphi7检测到异常类 eaccessviolation,异常信息:'Access violation at address 0047D5C7 in module
网友分享于:2013-05-29浏览:649次
Delphi7检测到错误类 eaccessviolation,错误信息:'Access violation at address 0047D5C7 in module
工程 Project1.exe 检测到错误类 eaccessviolation,错误信息:'Access violation at address 0047D5C7 in module 'Project1.exe'.Read of address 00000068'.进程中止.使用单步或运行继续运行
调试运行的时候出现这样的错误,把那段代码贴出来求大伙帮看看是怎么回事,我是新手,不要骂我笨啊
分不多,如果成功解决的话再加分,谢谢各位了
************************错误代码*************************************************
Function TForm1.SendToServer(AThread:TIdPeerThread;Cmd:String): Boolean;
var
MyStream: TMemoryStream;
i:integer;
begin
MyStream:=TMemoryStream.Create;
try
MyStream.Write(Cmd[1],Length(Cmd));
MyStream.Position:=0;
i:=MyStream2.size;
AThread.Connection.WriteLn(inttostr(i)); //提示就是在这里有错误
AThread.Connection.WriteStream(MyStream); //这句也和上面的一样有错误
Result := True;
except
AThread.Connection.Disconnect;
AThread.Terminate;
MyStream.Free;
Result := False;
end;
MyStream.Free;
end;
**********************************************************************************
procedure TForm1.TCPServer1Execute(AThread: TIdPeerThread);
var
MyStream: TMemoryStream;
begin
MyStream:=TMemoryStream.Create;
try
RecCMD:=AThread.Connection.ReadLn();
except
Exit;
end;
case strtoint(RecCMD) of
011:begin
if ReadSeverStream(AThread,TempStr) then
begin
if TempStr='返回数据成功' then
AThread.Connection.WriteLn('CMD012'); //这句话放在这里就好使,可以成功发送出去数据
end;
end;
end;
end;
------解决方案--------------------
楼主的程序本身就有问题
try
except
.......
MyStream.Free;
.......
end;
MyStream.Free;
如果出现异常,那么MyStream就会被再次释放,av错误!
另外不知道MyStream2是哪里来的
AThread.Connection.WriteLn(inttostr(i));
AThread.Connection.WriteStream(MyStream); //
这2句本身没有错,很有可能是Connection已经无效
以上就是关于eaccessviolation的全部内容,相信你一定会非常满意,。
本文来自电脑杂谈,转载请注明本文网址:
http://www.pc-fly.com/a/ruanjian/article-698-1.html
记住