Enumerating Objects
It's easy to enumerate all the objects, such as
Win32_LogicalDisk
, that are available to you. The third page in my WMI demo program does just this, and can be seen running in Figure 19.4. The
Figure 19.4. All the WMI objects have been enumerated.
The code for the page in Figure 19.4 can be seen in Listing 19.4. The code starts off by creating a new ManagementClass object. It then creates an EnumerationOptions class, and the EnumerateDeep property is set to false. Then, walking through the collection in a for each construct allows you to examine all the objects. Listing 19.4 Enumerating Through the WMI Objects
ManagementClass newClass = new ManagementClass();
EnumerationOptions options = new EnumerationOptions();
options.EnumerateDeep = false;
foreach( ManagementObject o in newClass.GetSubclasses( options ) )
{
Response.Write( o["__Class"] + "<br>\r\n" );
}
|
SummaryWMI is a powerful tool for keeping track of applications and servers. It's simple, yet powerful. In this chapter, you've learned the basics of using WMI. You can do even more simply by deciding what you want to do and then using WMI to carry out the task.
At the writing of this book, WMI was in a state of flux. As such, this chapter had to be more an introduction than anything else. By the time the book is on the
|
Chapter 20. Writing for Mobile DevicesIn this chapter
Mobile devices, such as Internet-enabled
A large number of different types of devices are
Handheld computers are generally on the other end of the mobile device spectrum, with capabilities that rival desktop computers of only a few
The wide variation of capabilities as well as multiple markup languages make it difficult to develop Web applications that can be used by any mobile device. To aid in the development of mobile Web applications, Microsoft has an add-on module for ASP.NET called The Mobile Internet Toolkit. In this chapter, you will learn about the different types of markup used on mobile devices and how to use Microsoft's Mobile Internet Toolkit to develop applications that can be used on any mobile device. |