一个DLL过程,明明我在主程序单测试时OK,但是加回线程里面就出错.提示下面这些XXXX
Project Wonder.exe raised exception class EAccessViolation with message 'Access violation at address 00428014 in module 'wonder.exe'.Write of address 0000000F'.Process stopped.Use Step or Run to continue
这是怎么回事?我不加入线程里面是成功的,应该这个过程的语句没有问题.
这个是线程语句;
procedure SQLFiveThread.Execute;
begin
FiveSQL(Longint(FiveFormRef),WonderForm.AQShowType.Connection,
WonderForm.Caption,
WonderForm.AQShowType.FieldbyName('TypeID').AsString,
WonderForm.AQShowType.FieldByName('OutNum').AsInteger);
{ Place thread code here }
end;
加入这个过程就出错:
procedure TWonderForm.AQShowTypeAfterScroll(DataSet: TDataSet);
//
begin
//
if Assigned(FiveFormRef) then
SQLFiveThread.Create(False);
end;
但是单独这样使用没有出错;
procedure TWonderForm.dxTestClick(Sender: TObject);
begin
if assigned(FiveFormRef) then
FiveSQL(Longint(FiveFormRef),WonderForm.AQShowType.Connection,
Caption,WonderForm.AQShowType.FieldbyName('TypeID').AsString,
WonderForm.AQShowType.FieldByName('OutNum').AsInteger);
end;