Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to implement the WMI WIN32 calls

Status
Not open for further replies.

Bachatero

Programmer
Aug 30, 2006
36
0
0
NL
Hi all,

I use VBS (Visual Basic Script) to automate some tasks. However, sometimes I miss some nice and handy features in VBS.

As well I use Borland C++. Now I will try to use borland to perform these tasks. Do somebody know were I can find some simple examples how to implement the WMI Win32 calls with borland C++.

Thanks in advance,

Johan
 
While this is using Delphi, it should be helpful in indicating what needs to be done.

faq102-7315
faq102-7316

It is not possible for anyone to acknowledge truth when their salary depends on them not doing it.
 
Thanks for the information.

Hi Glenn,

I used the code that was posted on the: Get System information from WMI faq102-7315

I have just a question:

The function below generates the following error code:

Code:
function WMIRowFindFirst(ObjectSet: ISWbemObjectSet; var ENum: IEnumVariant; var tempobj: OleVariant): boolean;
// finds the first row in a result set.
  var
    Value: Longint;
  begin
    Enum :=  (ObjectSet._NewEnum) as IEnumVariant;
    Result := (ENum.Next(1, tempObj, @Value) = 0);
  end;

The following line generates this error:

Result := (ENum.Next(1, tempObj, @Value) = 0);

[DCC Error] wmiserv.pas(75): E2033 Types of actual and formal var parameters must be identical

I found this message back on the internet, however I still can't solve it.

Can anyone give me a hint how to solve this.

Thanks in advance,

Johan

 
If you must work on Windows Vista or later, can I suggest you to learn PowerShell?
Is easy to use and you can write programs with wmi very quickly.

NOTE: For Windows XP you can also install PowerShell package
 
It is working now,

I changed:

var
Value: Longint;

To

var
Value: Cardinal;

Thanks,

Johan
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top