首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > .NET > .NET >

idhttp1在线程中为啥会出错啊该如何处理

2012-03-05 
idhttp1在线程中为啥会出错啊?DELPHI中运行会有类似这样的错误,Project1.exe faulted with message: acce

idhttp1在线程中为啥会出错啊?
DELPHI中运行会有类似这样的错误,
Project1.exe faulted with message: 'access violation at 0x00406761: write of address 0x01de0e08'. Process Stopped. Use Step or Run to continue.
如果直接运行程序,有时还有个提示出错了,有时什么提示也没有就退出了



for i:=1 to 20 do 
CreateThread(nil, 0, @CheckAcc, pointer(id), 0, dwThreadID);


procedure CheckAcc(vid:Integer);stdcall;
var
  str:String;
  idhttp1:TIdHTTP;
begin
  try
  idhttp1:=TIdHttp.Create;
  str:=idhttp1.Get('http://www.163.com/');
  except
  idhttp1.Free;
  exit;
  end;


  idhttp1.Free;
end;

[解决办法]
如果你不想用TThread那就用BeginThread代替CreateThread吧。

热点排行