Windows Management Instrumentation SDK Sample


Snap-in

The Snap-in sample demonstrates how to get started with a WMI-enabled MMC snap-in.  To make it easier for the key design factors to be seen, this sample is kept to absolute minimal features and assumes that you have already built and understand the concepts from Advanced Client and Consumer samples. It also assumes that you are familiar with general snap-in programming and you only need to see the two technologies together.

 

This sample is a standalone snap-in without remoting capability. The code is designed to be easy to follow and doesn't necessarily show a good practice for building 'real' WMI-enabled snap-ins. Concentrate on the steps and architect your snap-in in a way that makes sense for you. Use the Advanced Client sample to add office equipment instances to the SAMPLE_Office namespace before running this sample.

 

If this snap-in is displaying office equipment instances when you use the Client sample to add more equipment, a WMI Temporary Event setup by the snap-in will trigger a refresh of this list.

 

Building the Snap-in

 

The application can be built from the command line using NMAKE, or it can be built using Microsoft Visual C++.  You must also have the Platform SDK installed since this sample uses the latest MMC 1.2 definitions.

 

From the command line in the sample installation directory:

 

NMAKE /f "Makefile"

 

From Microsoft Visual C++:

 

1.      Select File + Open Workspace

2.      Select the snapin.dsp file. Change the file filter if necessary to see this file.

 

Running the Snap-in

 

If you build the snap-in from Visual C++ using the dsp file, it is automatically registered as a snap-in. If you used the NMAKE makefile, you must manually register it using regsvr32.exe.

 

Once the snap-in registered, you can add it to an MMC toolset by using the “Add/Remove Snap-in” menu item in MMC to add the “Office Equipment” standalone snap-in. For simplicity, the snap-in only displays Office Equipment already in the sample namespace.

 

© 1998-2001 Microsoft Corporation. All rights reserved.