由于请求webservice的时候比较费时,而且我需要每隔几秒钟请求一次,这样的话,主界面基本上就是一卡一卡的,所以就考虑把调用webservice的代码放到一个线程里,免得影响用户操作。我这样做为什么虽然可以正常运行,但是调试时后会报错:
type
TMainForm = class(TForm)
省略
private
{ Private declarations }
public
end;type
TMyThread =class(TThread)
HTTPRIO1: THTTPRIO;//《--------------我把mainform中的这个移到这里了。
private
FFlag:Integer;
procedure Getws;
protected
procedure Execute ; override;
public
constructor Create(aFlag:Integer);
end;
省略
procedure TMyThread.Getws;
var
WsObj,WsObj2:HosServicePortType;
i:Integer;
btimestr:string;
begin
try
CoInitialize(Nil);
WsObj:=HTTPRIO1 as HosServicePortType;//这样初始化
WsArray:=WsObj.getBook(hosid,FormatDateTime('yyyymmdd',d1));//连接webservice并查询,这句错误
finally
CoUninitialize;
end;
在调试的时候报错:First chance exception at $7C812AFB. Exception class EAccessViolation with message 'Access violation at address 0066B99B in module 'HosClient.exe'. Read of address 00000000'. Process HosClient.exe (3904)刚学习线程,请多指教。
type
TMainForm = class(TForm)
省略
private
{ Private declarations }
public
end;type
TMyThread =class(TThread)
HTTPRIO1: THTTPRIO;//《--------------我把mainform中的这个移到这里了。
private
FFlag:Integer;
procedure Getws;
protected
procedure Execute ; override;
public
constructor Create(aFlag:Integer);
end;
省略
procedure TMyThread.Getws;
var
WsObj,WsObj2:HosServicePortType;
i:Integer;
btimestr:string;
begin
try
CoInitialize(Nil);
WsObj:=HTTPRIO1 as HosServicePortType;//这样初始化
WsArray:=WsObj.getBook(hosid,FormatDateTime('yyyymmdd',d1));//连接webservice并查询,这句错误
finally
CoUninitialize;
end;
在调试的时候报错:First chance exception at $7C812AFB. Exception class EAccessViolation with message 'Access violation at address 0066B99B in module 'HosClient.exe'. Read of address 00000000'. Process HosClient.exe (3904)刚学习线程,请多指教。
解决方案 »
- delphi使用循环语句向EXCEL插入多个图片,为何只有最后一张图片的大小是指定的大小?但如果单独插入一张图片却很正常? 小弟在此候教!
- 想在image上画一个粗线,如何在鼠标未按下去的时候让鼠标显示为一个红色半透明的圆形呢?
- 构造查询的时候遇到的问题!
- 关于操作系统的问题,导致无法正常连接ASTA服务器端程序.
- adotable的active属性无法设置为 true
- 谁有delphi深度历险电子书
- 请问如何把图片转换成字符串
- CSDN Direct浏览器完整版Release1.11,综合离线浏览和在线浏览两大功能,看贴飞快
- 请问delphi中如何动态的建立对象?
- 为什么 DELPHI 编译出的程序一般的来说至少都有300k呢?
- delphi压缩ACCESS数据库时出现错误
- delphi绘图
例如:Httprio在哪创建的