Sergey_ » 20 апр 2007, 12:35
Работает, как надо, все выводит, но в конце вылетам с AV. Может кто сталкивался?
Код: Выделить всё
CoInitialize(nil);
Locator := TSWbemLocator.Create(nil);
Services := Locator.ConnectServer(const_ComputerName, const_Namespace,'','','','', 0, nil);
ObjSet := Services.ExecQuery('SELECT * FROM Win32_NetworkAdapterConfiguration where IPEnabled=TRUE', const_SQLLang, 0, nil);
if ObjSet.Count > 0 then
begin
enum := ObjSet._NewEnum as IEnumVariant;
while enum.Next( 1, Res, cardFetched) = S_OK do
begin
curObj := IInterface(Res) as ISWbemObject;
WriteLn( curObj.GetObjectText_(0) );
curObj := nil;
end;
end;
[B] Locator.Free;[/B]
CoUninitialize;
Работает, как надо, все выводит, но в конце вылетам с AV. Может кто сталкивался?
[code]
CoInitialize(nil);
Locator := TSWbemLocator.Create(nil);
Services := Locator.ConnectServer(const_ComputerName, const_Namespace,'','','','', 0, nil);
ObjSet := Services.ExecQuery('SELECT * FROM Win32_NetworkAdapterConfiguration where IPEnabled=TRUE', const_SQLLang, 0, nil);
if ObjSet.Count > 0 then
begin
enum := ObjSet._NewEnum as IEnumVariant;
while enum.Next( 1, Res, cardFetched) = S_OK do
begin
curObj := IInterface(Res) as ISWbemObject;
WriteLn( curObj.GetObjectText_(0) );
curObj := nil;
end;
end;
[B] Locator.Free;[/B]
CoUninitialize;
[/code]