Hello!

I am writing the first program from WMI to Delphi Embarcadero XE3. Added ISWbemLocator, asks to enter server, enter root \ COMV2, error. When I try to create this object dynamically, a search window of a certain msi file appears. How to win?

Chew on an idiot in an idiotic language, otherwise my brain remains are boiling ...

PS: for example, how I create this object dynamically ...

type TForm1 = class(TForm) procedure FormCreate(Sender: TObject); private { Private declarations } Services: ISWbemServices; public { Public declarations } end; var Form1: TForm1; implementation {$R *.dfm} procedure TForm1.FormCreate(Sender: TObject); var Locator: ISWbemLocator; begin Locator := CoSWbemLocator.Create; Services := Locator.ConnectServer('.', 'root\cimv2', '', '', '', '', 0, nil) end; end. 

The message that the system gives

  • Message and file name attach. - gbg
  • Added screen message that displays the program - garmayev
  • wbemtest works fine? - gbg
  • What is it? and what is it eaten with? I just come across wmi for the first time, and on Embarcadero I moved only 2-3 weeks ago (I worked only under 7 times) - garmayev
  • This is a GUI utility that can create custom WMI objects to order and query WQL. It starts simply - through Start -> Run. - gbg pm

1 answer 1

Good day!

Try using SWbemLocator instead of CoSWbemLocator ,
as well as a delphi code generator using WMI classes
https://theroadtodelphi.com/wmi-delphi-code-creator/