THI.
I have the piece of code show below.
when it gets to the line
FWMIService := FSWbemLocator.ConnectServer
it simply opwns the CPU window and does never get tot except section.
Running Delphi 12.1 on win 64bit.
(The second piece of code shows how the procedure is called).
Any idea anybody?
procedure GetWin32_PrintJobInfo;
const
WbemUser ='';
WbemPassword ='';
WbemComputer = 'localhost';
wbemFlagForwardOnly = $00000020;
var
FSWbemLocator : OLEVariant;
FWMIService : OLEVariant;
FWbemObjectSet: OLEVariant;
FWbemObject : OLEVariant;
oEnum : IEnumvariant;
iValue : LongWord;
str:String;
begin;
FSWbemLocator := CreateOleObject('WbemScripting.SWbemLocator');
try
FWMIService := FSWbemLocator.ConnectServer('192.168.1.70', 'root\CIMV2', WbemUser, WbemPassword);
except
on E:EOleException do
writeln(e.message);
on E:sysutils.Exception do
writeln(e.message);
end;
begin
try
CoInitialize(nil);
try
GetWin32_PrintJobInfo;
finally
CoUninitialize;
end;
except
on E:EOleException do
Writeln(Format('EOleException %s %x', [E.Message,E.ErrorCode]));
on E:Exception do
Writeln(E.Classname, ':', E.Message);
end;