unit UnitInfo;
interface
uses Classes,ComCtrls,ADODB,unitclass;
type
TSoftInfo = class(TThread)
private
Fxh:integer;
FhMutex:THandle;
Fitem:Tlistitem;
protected
procedure ShowInfo;
procedure Execute;
override;
public
FAddr
ointer;
SqlList:TADOQuery;
FFields:integer;
FView:TListView;
constructor create;
end;
implementation
uses forms,Windows,SysUtils;
{ TSoftInfo }
constructor TSoftInfo.create;
begin
Fxh:=1;
FhMutex:=CreateMutex(nil,false,nil);
SqlList:=TADOQuery.Create(nil);
freeonterminate:=false;
inherited create(true);
end;
procedure TSoftInfo.Execute;
begin
if WaitForSingleObject(FhMutex,INFINITE)=WAIT_OBJECT_0 then
try
SqlList.Open;
while (not SqlList.Eof) and (not terminated) and (not application.Terminated)do
begin
ShowInfo;
inc(Fxh);
SqlList.Next;
end;
finally
SqlList.Close;
freeandnil(SqlList);
Pointer(FAddr^):=nil;
FAddr:=nil;
ReleaseMutex(FhMutex);
CloseHandle(FhMutex);
end;
end;
procedure TSoftInfo.ShowInfo;
var i:integer;
Dbid:SelfId;
begin
Fitem:=Fview.Items.Add;
new(Dbid);
Dbid.id:=SqlList.FieldByName('id').AsInteger;
Dbid.sl:=0;
Fitem.ImageIndex:=SqlList.FieldByName('xb').AsInteger;
Fitem.Data:=Dbid;
Fitem.Caption:=inttostr(Fxh);
for i:=1 to FFieldsdo
fitem.SubItems.Add(SqlList.Fields
.AsString);
end;
end.