|
QueryParser
This sample demonstrates
the using the Query parser which is supplied ad a COM object.
This application is a
console application meant to be run at the command line. The code is designed to be easy to follow and
doesn't necessarily show a good practice for building 'real' WMI client
applications. Concentrate on the steps
and architect your application in a way that makes sense for you.
Using the QueryParser Sample
The QueryParser
sample can be built from the command line using NMAKE, or it can be built using
Microsoft Visual C++.
From the command line
in the sample installation directory, type the following:
NMAKE /f “Makefile”
From Microsoft Visual
C++:
1.
Select File +
Open Workspace
2. Select the QueryParser.DSP file
Once built the QueryParser sample application
can be run from the command line in the sample installation directory:
QueryParser
The valid syntax for QueryParser:
QueryParser
With no parameters, the usage message is printed out which will have
several sample queries.
General Notes
Things
to remember when you're building your own WMI client application:
1.
WMI interfaces are defined
in wmiutils.h found in the wmi\include
directory.
2.
WMI interface CLSIDs are defined in wbemuuid.lib.
If you get unresolved externals in interfaces and CLSIDs,
this is what is missing.
3.
You'll need to link with
oleaut32.lib and ole32.lib to get the needed COM support.
4. If you're using the makefiles, don't forget to set the Visual C++ environment variables. This is done by running VCVARS32.BAT.