Registriert seit: 12. Mär 2007
486 Beiträge
|
Re: Threads bleiben teilweise erhalten
28. Aug 2009, 15:18
Einmal die Create Methode
Delphi-Quellcode:
constructor TWMIThread.Create(OnWMIData: TOnWMIData; WMIClass: string;WMIHost,WMIUser,WMIPass : string);
begin
inherited Create(False);
fOnWMIData := OnWMIData;
fWMIClass := WMIClass;
fWMIHost := WMIHost;
fWMIUser := WMIUser;
fWMIPass := WMIPass;
fWhere := '';
FreeOnTerminate := true;
end;
Die Execute Methode
Delphi-Quellcode:
procedure TWMIThread.Execute;
var
wmi : TWMI;
i : integer;
begin
inherited;
CoInitialize( nil);
wmi := LoadClassInData(fWMIClass, fWMIHost, fWMIUser, fWMIPass);
wmi.WMIClass := fWMIClass;
if Assigned(fOnWMIData) then
fOnWMIData( wmi);
for i:=0 to wmi.InstanceCount-1 do
wmi.Instance[i].Free;
OleUninitialize;
end;
|