多线程中遇到 'interface not supported' 怎么解决?

weiming3119 2014-11-01 04:27:03
不使用线程,很正常,使用了线程,就出现:project raised exception class EintfcastError with message 'interface not supported'.Process stopped.Use Step or Run to contiune

请有经验的高手指点一下。


function g_getHtml(http:string):string; //截取网页的方式
var
req:IXMLHTTPRequest;
begin
req:=CoXMLHTTPRequest.Create;//这句代码在多线程中执行时候报错
req.open('Get',http, False,EmptyParam, EmptyParam);
req.send(EmptyParam);
result:=req.responseText;
end;


...全文
242 2 打赏 收藏 转发到动态 举报
写回复
用AI写文章
2 条回复
切换为时间正序
请发表友善的回复…
发表回复
lyhoo163 2014-11-02
  • 打赏
  • 举报
回复
试试: req := CoXMLHTTP.Create; 早期版本: req := CoXMLHTTPRequest.Create;
武稀松 2014-11-01
  • 打赏
  • 举报
回复
线程没初始化COM环境,在你的线程里先做一件事. CoInitialize(nil)

16,749

社区成员

发帖
与我相关
我的任务
社区描述
Delphi 语言基础/算法/系统设计
社区管理员
  • 语言基础/算法/系统设计社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧