2025-04-27 07:49:33 -04:00

568 lines
30 KiB
HTML
Raw Permalink Blame History

<!- Copyright (c) 1999-2001 Microsoft Corporation, All Rights Reserved ->
<!doctype html public "-//W3C//DTD HTML 4.0 Draft//EN">
<html xmlns:v="urn:schemas-microsoft-com:vml"
xmlns:o="urn:schemas-microsoft-com:office:office"
xmlns:w="urn:schemas-microsoft-com:office:word"
xmlns="http://www.w3.org/TR/REC-html40">
<head>
<meta http-equiv=Content-Type content="text/html; charset=windows-1251">
<meta name=ProgId content=Word.Document>
<meta name=Generator content="Microsoft Word 9">
<meta name=Originator content="Microsoft Word 9">
<link rel=File-List href="./CustomViews_files/filelist.xml">
<title>WMI SDK Sample - CustomViews</title>
<!--[if gte mso 9]><xml>
<o:DocumentProperties>
<o:Author>Michael Maston</o:Author>
<o:Template>Normal</o:Template>
<o:LastAuthor>Michael Maston</o:LastAuthor>
<o:Revision>16</o:Revision>
<o:TotalTime>154</o:TotalTime>
<o:Created>1999-01-25T16:53:00Z</o:Created>
<o:LastSaved>2001-01-20T21:30:00Z</o:LastSaved>
<o:Pages>2</o:Pages>
<o:Words>806</o:Words>
<o:Characters>4597</o:Characters>
<o:Company>Microsoft</o:Company>
<o:Lines>38</o:Lines>
<o:Paragraphs>9</o:Paragraphs>
<o:CharactersWithSpaces>5645</o:CharactersWithSpaces>
<o:Version>9.2720</o:Version>
</o:DocumentProperties>
</xml><![endif]--><!--[if gte mso 9]><xml>
<w:WordDocument>
<w:Zoom>103</w:Zoom>
</w:WordDocument>
</xml><![endif]-->
<style>
<!--
/* Font Definitions */
@font-face
{font-family:"MS Mincho";
panose-1:2 2 6 9 4 2 5 8 3 4;
mso-font-alt:"MS Mincho";
mso-font-charset:128;
mso-generic-font-family:modern;
mso-font-pitch:fixed;
mso-font-signature:-1610612033 1757936891 16 0 131231 0;}
@font-face
{font-family:Verdana;
panose-1:2 11 6 4 3 5 4 4 2 4;
mso-font-charset:0;
mso-generic-font-family:swiss;
mso-font-pitch:variable;
mso-font-signature:536871559 0 0 0 415 0;}
@font-face
{font-family:"\@MS Mincho";
panose-1:2 2 6 9 4 2 5 8 3 4;
mso-font-charset:128;
mso-generic-font-family:modern;
mso-font-pitch:fixed;
mso-font-signature:-1610612033 1757936891 16 0 131231 0;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
{mso-style-parent:"";
margin:0in;
margin-bottom:.0001pt;
mso-pagination:widow-orphan;
font-size:12.0pt;
font-family:"Times New Roman";
mso-fareast-font-family:"Times New Roman";
color:black;}
a:link, span.MsoHyperlink
{color:blue;
text-decoration:underline;
text-underline:single;}
a:visited, span.MsoHyperlinkFollowed
{color:blue;
text-decoration:underline;
text-underline:single;}
p.MsoPlainText, li.MsoPlainText, div.MsoPlainText
{margin:0in;
margin-bottom:.0001pt;
mso-pagination:widow-orphan;
font-size:10.0pt;
font-family:"Courier New";
mso-fareast-font-family:"Times New Roman";}
@page Section1
{size:8.5in 11.0in;
margin:1.0in 1.25in 1.0in 1.25in;
mso-header-margin:.5in;
mso-footer-margin:.5in;
mso-paper-source:0;}
div.Section1
{page:Section1;}
/* List Definitions */
@list l0
{mso-list-id:341511928;
mso-list-type:hybrid;
mso-list-template-ids:-772083392 -175488598 67698713 67698715 67698703 67698713 67698715 67698703 67698713 67698715;}
@list l0:level1
{mso-level-start-at:3;
mso-level-tab-stop:.5in;
mso-level-number-position:left;
text-indent:-.25in;}
@list l0:level2
{mso-level-number-format:alpha-lower;
mso-level-tab-stop:1.0in;
mso-level-number-position:left;
text-indent:-.25in;}
@list l0:level5
{mso-level-number-format:alpha-lower;
mso-level-tab-stop:2.5in;
mso-level-number-position:left;
text-indent:-.25in;}
@list l1
{mso-list-id:994183607;
mso-list-type:hybrid;
mso-list-template-ids:-208100182 67698703 67698713 67698715 67698703 67698713 67698715 67698703 67698713 67698715;}
@list l1:level1
{mso-level-tab-stop:.5in;
mso-level-number-position:left;
text-indent:-.25in;
font-family:"Times New Roman";}
@list l2
{mso-list-id:1382680151;
mso-list-type:hybrid;
mso-list-template-ids:1228189558 792264362 67698713 67698715 67698703 67698713 67698715 67698703 67698713 67698715;}
@list l2:level1
{mso-level-tab-stop:.75in;
mso-level-number-position:left;
margin-left:.75in;
text-indent:-.25in;}
ol
{margin-bottom:0in;}
ul
{margin-bottom:0in;}
-->
</style>
<!--[if gte mso 9]><xml>
<o:shapedefaults v:ext="edit" spidmax="1027"/>
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext="edit">
<o:idmap v:ext="edit" data="1"/>
</o:shapelayout></xml><![endif]-->
<meta name=MS-HAID content=VJsamples>
</head>
<body bgcolor=white lang=EN-US link=blue vlink=blue style='tab-interval:.5in'>
<div class=Section1>
<table border=0 cellpadding=0 width="100%" style='width:100.0%;mso-cellspacing:
1.5pt;mso-padding-alt:0in 0in 0in 0in'>
<tr>
<td width=160 style='width:120.0pt;background:#330099;padding:.75pt .75pt .75pt .75pt'>
<p class=MsoNormal><span style='font-size:10.0pt;font-family:Verdana;
color:white'>&nbsp;<nobr><b>Windows Management Instrumentation SDK Sample</b></span>
<o:p></o:p></p>
</td>
</tr>
</table>
<p class=MsoPlainText><br>
<strong><span style='font-size:13.5pt;font-family:Verdana'>Custom View OCX<43>s</span></strong><br>
<br>
<span style='font-family:Verdana;mso-fareast-font-family:"MS Mincho"'>This
sample contains a description of the custom view OCX<43>s for WMI and the
corresponding automation interface.<span style="mso-spacerun: yes"><EFBFBD>
</span>Custom views provide non-generic views of objects contained in the WMI database.<span
style="mso-spacerun: yes"><EFBFBD> </span>The WMI CIM Studio Object Browser, and other
programs may use these custom views to display application specific views of
WMI objects.<span style="mso-spacerun: yes"><EFBFBD> </span>For example, a custom view
of a disk drive might show the amount of free space in a bar chart, and so on.<o:p></o:p></span></p>
<p class=MsoPlainText><span style='font-family:Verdana;mso-fareast-font-family:
"MS Mincho";mso-bidi-font-family:"Times New Roman"'><![if !supportEmptyParas]>&nbsp;<![endif]><o:p></o:p></span></p>
<p class=MsoPlainText><span style='font-family:Verdana;mso-fareast-font-family:
"MS Mincho";mso-bidi-font-family:"Times New Roman"'>This sample is a
dialog-based application created by AppWizard and uses the Microsoft Foundation
Classes (MFC) for simplicity. The code is designed to be easy to follow and
doesn't necessarily show a good practice for building 'real' WMI client apps.
Concentrate on the steps and architect your application in a way that makes
sense for you.<o:p></o:p></span></p>
<p class=MsoPlainText><span style='font-family:Verdana;mso-fareast-font-family:
"MS Mincho";mso-bidi-font-family:"Times New Roman"'><![if !supportEmptyParas]>&nbsp;<![endif]><o:p></o:p></span></p>
<p class=MsoPlainText><span style='font-family:Verdana;mso-fareast-font-family:
"MS Mincho";mso-bidi-font-family:"Times New Roman"'><![if !supportEmptyParas]>&nbsp;<![endif]><o:p></o:p></span></p>
<p class=MsoNormal><strong><span style='font-family:Verdana;font-weight:normal'>Getting
Started with the Custom View OCX<43>s</span></strong><strong><span
style='font-family:Verdana;mso-fareast-font-family:"MS Mincho";font-weight:
normal'><o:p></o:p></span></strong></p>
<p class=MsoNormal><strong><span style='font-family:Verdana;mso-fareast-font-family:
"MS Mincho";font-weight:normal'><![if !supportEmptyParas]>&nbsp;<![endif]><o:p></o:p></span></strong></p>
<p class=MsoPlainText><span style='font-family:Verdana;mso-fareast-font-family:
"MS Mincho"'>Any number of views can be defined for each class stored in the
WMI database.<span style="mso-spacerun: yes"><EFBFBD> </span>To add a custom view to
the WMI database, it is necessary to create a new instance of the <i>ClassView</i>
class.<span style="mso-spacerun: yes"><EFBFBD> </span>Below is an example of a MOF
file that can be compiled to define a custom view for the <i>Win32LogicalDisk</i>
class.<span style="mso-spacerun: yes"><EFBFBD> </span>In this MOF file, the <i>id</i>
property takes the form of <i>ClassName.ViewName</i>, so that custom views can
be uniquely identified and easily recognized.<span style="mso-spacerun: yes"><EFBFBD>
</span><o:p></o:p></span></p>
<p class=MsoPlainText><span style='mso-fareast-font-family:"MS Mincho"'><![if !supportEmptyParas]>&nbsp;<![endif]><o:p></o:p></span></p>
<p class=MsoPlainText><span style='font-family:Verdana;mso-fareast-font-family:
"MS Mincho"'>The WMI CIM Studio and Object Browser applications determine what
custom views are available for a given class by querying for all instances of <i>ClassView</i>
such that the <i>ClassName</i> property is equal to the current class being
displayed.<o:p></o:p></span></p>
<p class=MsoPlainText><span style='font-family:Verdana;mso-fareast-font-family:
"MS Mincho"'><![if !supportEmptyParas]>&nbsp;<![endif]><o:p></o:p></span></p>
<p class=MsoPlainText><span style='font-family:Verdana;mso-fareast-font-family:
"MS Mincho"'><span style='mso-tab-count:2'><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> </span>#pragma
namespace(&quot;\\\\.\\root\\cimv2&quot;)<o:p></o:p></span></p>
<p class=MsoPlainText><span style='font-family:Verdana;mso-fareast-font-family:
"MS Mincho"'><![if !supportEmptyParas]>&nbsp;<![endif]><o:p></o:p></span></p>
<p class=MsoPlainText><span style='font-family:Verdana;mso-fareast-font-family:
"MS Mincho"'><span style='mso-tab-count:2'><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> </span>class
ClassView<o:p></o:p></span></p>
<p class=MsoPlainText><span style='font-family:Verdana;mso-fareast-font-family:
"MS Mincho"'><span style='mso-tab-count:2'><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> </span>{<o:p></o:p></span></p>
<p class=MsoPlainText><span style='font-family:Verdana;mso-fareast-font-family:
"MS Mincho"'><span style='mso-tab-count:3'><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> </span>[key]
string id;<o:p></o:p></span></p>
<p class=MsoPlainText><span style='font-family:Verdana;mso-fareast-font-family:
"MS Mincho"'><span style='mso-tab-count:3'><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> </span>string
title;<o:p></o:p></span></p>
<p class=MsoPlainText><span style='font-family:Verdana;mso-fareast-font-family:
"MS Mincho"'><span style='mso-tab-count:3'><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> </span>string
ClassName;<o:p></o:p></span></p>
<p class=MsoPlainText><span style='font-family:Verdana;mso-fareast-font-family:
"MS Mincho"'><span style='mso-tab-count:3'><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> </span>string
classid;<o:p></o:p></span></p>
<p class=MsoPlainText><span style='font-family:Verdana;mso-fareast-font-family:
"MS Mincho"'><span style='mso-tab-count:3'><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> </span>string
codebase;<o:p></o:p></span></p>
<p class=MsoPlainText><span style='font-family:Verdana;mso-fareast-font-family:
"MS Mincho"'><span style='mso-tab-count:3'><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> </span>string
version;<o:p></o:p></span></p>
<p class=MsoPlainText><span style='font-family:Verdana;mso-fareast-font-family:
"MS Mincho"'><span style='mso-tab-count:2'><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> </span>};<o:p></o:p></span></p>
<p class=MsoPlainText><span style='font-family:Verdana;mso-fareast-font-family:
"MS Mincho"'><![if !supportEmptyParas]>&nbsp;<![endif]><o:p></o:p></span></p>
<p class=MsoPlainText><span style='font-family:Verdana;mso-fareast-font-family:
"MS Mincho"'><span style='mso-tab-count:2'><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> </span>instance
of ClassView<o:p></o:p></span></p>
<p class=MsoPlainText><span style='font-family:Verdana;mso-fareast-font-family:
"MS Mincho"'><span style='mso-tab-count:2'><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> </span>{<o:p></o:p></span></p>
<p class=MsoPlainText><span style='font-family:Verdana;mso-fareast-font-family:
"MS Mincho"'><span style='mso-tab-count:3'><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> </span>id
= &quot;Win32_LogicalDisk.View1&quot;;<o:p></o:p></span></p>
<p class=MsoPlainText><span style='font-family:Verdana;mso-fareast-font-family:
"MS Mincho"'><span style='mso-tab-count:3'><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> </span>title
= &quot;Custom View of Win32_LogicalDisk&quot;;<o:p></o:p></span></p>
<p class=MsoPlainText><span style='font-family:Verdana;mso-fareast-font-family:
"MS Mincho"'><span style='mso-tab-count:3'><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> </span>ClassName
= &quot;Win32_LogicalDisk&quot;;<o:p></o:p></span></p>
<p class=MsoPlainText><span style='font-family:Verdana;mso-fareast-font-family:
"MS Mincho"'><span style='mso-tab-count:3'><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> </span>classid
= &quot;{D5FF1886-0191-11D2-853D-00C04FD7BB08}&quot;;<o:p></o:p></span></p>
<p class=MsoPlainText><span style='font-family:Verdana;mso-fareast-font-family:
"MS Mincho"'><span style='mso-tab-count:3'><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> </span>codebase
= &quot;&quot;;<o:p></o:p></span></p>
<p class=MsoPlainText><span style='font-family:Verdana;mso-fareast-font-family:
"MS Mincho"'><span style='mso-tab-count:3'><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> </span>version
= &quot;1.0&quot;;<o:p></o:p></span></p>
<p class=MsoPlainText><span style='font-family:Verdana;mso-fareast-font-family:
"MS Mincho"'><span style='mso-tab-count:2'><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> </span>};<o:p></o:p></span></p>
<p class=MsoPlainText><span style='mso-fareast-font-family:"MS Mincho"'><![if !supportEmptyParas]>&nbsp;<![endif]><o:p></o:p></span></p>
<p class=MsoPlainText><span style='font-size:12.0pt;mso-bidi-font-size:10.0pt;
font-family:Verdana'>Building the Win32LogicalDisk Sample<o:p></o:p></span></p>
<p class=MsoPlainText>&nbsp;</p>
<p class=MsoPlainText><span style='font-family:Verdana'>The application can be
built from the command line using NMAKE, or it can be built using Microsoft
Visual C++.<span yes>&nbsp; </span><o:p></o:p></span></p>
<p class=MsoPlainText><span style='font-family:Verdana'>&nbsp;<o:p></o:p></span></p>
<p class=MsoPlainText><span style='font-family:Verdana'>From the command line
in the sample installation directory: <o:p></o:p></span></p>
<p class=MsoPlainText><span style='font-family:Verdana'>&nbsp;<o:p></o:p></span></p>
<p class=MsoPlainText style='margin-left:.25in'><b><span style='font-family:
Verdana'>NMAKE /f &quot;Makefile&quot;<o:p></o:p></span></b></p>
<p class=MsoPlainText><span style='font-family:Verdana'>&nbsp;<o:p></o:p></span></p>
<p class=MsoPlainText><span style='font-family:Verdana'>From Microsoft Visual
C++: <o:p></o:p></span></p>
<p class=MsoPlainText><span style='font-family:Verdana'>&nbsp;<o:p></o:p></span></p>
<p class=MsoPlainText .5in list lfo2 level1 l0><span style='font-family:Verdana'>1.<span
Roman New Times></span></span><span style='font-size:7.0pt;font-family:Verdana'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
</span><span style='font-family:Verdana'>Select File + Open Workspace<o:p></o:p></span></p>
<p class=MsoPlainText .5in list lfo2 level1 l0><span style='font-family:Verdana'>2.<span
Roman New Times></span></span><span style='font-size:7.0pt;font-family:Verdana'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
</span><span style='font-family:Verdana'>Select the Win32LogicalDisk.dsp file<o:p></o:p></span></p>
<p class=MsoPlainText><span style='mso-fareast-font-family:"MS Mincho"'><![if !supportEmptyParas]>&nbsp;<![endif]><o:p></o:p></span></p>
<p class=MsoPlainText><span style='font-size:12.0pt;mso-bidi-font-size:10.0pt;
font-family:Verdana'>Using the Win32LogicalDisk Sample<o:p></o:p></span></p>
<p class=MsoPlainText><span style='mso-fareast-font-family:"MS Mincho"'><![if !supportEmptyParas]>&nbsp;<![endif]><o:p></o:p></span></p>
<p class=MsoPlainText><span style='font-family:Verdana;mso-fareast-font-family:
"MS Mincho"'>To see a sample custom view in the WMI CIM Studio follow these
steps:<o:p></o:p></span></p>
<p class=MsoPlainText><span style='font-family:Verdana;mso-fareast-font-family:
"MS Mincho"'><![if !supportEmptyParas]>&nbsp;<![endif]><o:p></o:p></span></p>
<p class=MsoPlainText style='margin-left:.5in;text-indent:-.25in;mso-list:l2 level1 lfo2;
tab-stops:list .5in .75in'><![if !supportLists]><span style='font-family:Verdana;
mso-fareast-font-family:"MS Mincho"'>1.<span style='font:7.0pt "Times New Roman"'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
</span></span><![endif]><span style='font-family:Verdana;mso-fareast-font-family:
"MS Mincho"'>Build the Win32LogicalDisk sample found in the WMI SDK directory under
samples\vc\customviews as described above.<o:p></o:p></span></p>
<p class=MsoPlainText style='tab-stops:list .75in'><span style='font-family:
Verdana;mso-fareast-font-family:"MS Mincho"'><![if !supportEmptyParas]>&nbsp;<![endif]><o:p></o:p></span></p>
<p class=MsoPlainText style='margin-left:.5in;text-indent:-.25in;mso-list:l2 level1 lfo2;
tab-stops:list .5in .75in'><![if !supportLists]><span style='font-family:Verdana;
mso-fareast-font-family:"MS Mincho"'>2.<span style='font:7.0pt "Times New Roman"'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
</span></span><![endif]><span style='font-family:Verdana;mso-fareast-font-family:
"MS Mincho"'>Use regsvr32 to register the resulting Win32LogicalDisk.ocx </span><span
style='font-family:Verdana'>at the command line in the sample installation
directory</span><span style='font-family:Verdana;mso-fareast-font-family:"MS Mincho"'>:<o:p></o:p></span></p>
<p class=MsoPlainText style='margin-left:-.25in;text-indent:.5in;tab-stops:
list .75in'><span style='font-family:Verdana;mso-fareast-font-family:"MS Mincho"'><![if !supportEmptyParas]>&nbsp;<![endif]><o:p></o:p></span></p>
<p class=MsoPlainText style='margin-left:1.25in;tab-stops:list .75in'><b><span
style='font-family:Verdana;mso-fareast-font-family:"MS Mincho"'>regsvr32
Win32LogicalDisk.ocx<o:p></o:p></span></b></p>
<p class=MsoPlainText style='tab-stops:list .75in'><span style='font-family:
Verdana;mso-fareast-font-family:"MS Mincho"'><![if !supportEmptyParas]>&nbsp;<![endif]><o:p></o:p></span></p>
<p class=MsoPlainText style='margin-left:.5in;text-indent:-.25in;mso-list:l0 level1 lfo4;
tab-stops:list .5in'><![if !supportLists]><span style='font-family:Verdana;
mso-fareast-font-family:"MS Mincho"'>3.<span style='font:7.0pt "Times New Roman"'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
</span></span><![endif]><span style='font-family:Verdana;mso-fareast-font-family:
"MS Mincho"'>Start the WMI CIM Studio application.<o:p></o:p></span></p>
<p class=MsoPlainText style='tab-stops:list .5in'><span style='font-family:
Verdana;mso-fareast-font-family:"MS Mincho"'><![if !supportEmptyParas]>&nbsp;<![endif]><o:p></o:p></span></p>
<p class=MsoPlainText style='margin-left:.5in;text-indent:-.25in;mso-list:l0 level1 lfo4;
tab-stops:list .5in'><![if !supportLists]><span style='font-family:Verdana;
mso-fareast-font-family:"MS Mincho"'>4.<span style='font:7.0pt "Times New Roman"'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
</span></span><![endif]><span style='font-family:Verdana;mso-fareast-font-family:
"MS Mincho"'>Use the MOF Compiler Wizard in WMI CIM Studio to compile the
&quot;CustomView.mof&quot; MOF file that is included with the sample.<o:p></o:p></span></p>
<p class=MsoPlainText style='tab-stops:list .5in'><span style='font-family:
Verdana;mso-fareast-font-family:"MS Mincho"'><![if !supportEmptyParas]>&nbsp;<![endif]><o:p></o:p></span></p>
<p class=MsoPlainText style='margin-left:.5in;text-indent:-.25in;mso-list:l0 level1 lfo4;
tab-stops:list .5in'><![if !supportLists]><span style='font-family:Verdana;
mso-fareast-font-family:"MS Mincho"'>5.<span style='font:7.0pt "Times New Roman"'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
</span></span><![endif]><span style='font-family:Verdana;mso-fareast-font-family:
"MS Mincho"'>In WMI CIM Studio, select the Win32_LogicalDisk class in the class
tree.<o:p></o:p></span></p>
<p class=MsoPlainText style='tab-stops:list .5in'><span style='font-family:
Verdana;mso-fareast-font-family:"MS Mincho"'><![if !supportEmptyParas]>&nbsp;<![endif]><o:p></o:p></span></p>
<p class=MsoPlainText style='margin-left:.5in;text-indent:-.25in;mso-list:l0 level1 lfo4;
tab-stops:list .5in'><![if !supportLists]><span style='font-family:Verdana;
mso-fareast-font-family:"MS Mincho"'>6.<span style='font:7.0pt "Times New Roman"'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
</span></span><![endif]><span style='font-family:Verdana;mso-fareast-font-family:
"MS Mincho"'>In the Object Viewer (right pane), click the &quot;Instances&quot;
button to display all instances of &quot;Win32_LogicalDisk&quot; on your local
machine.<o:p></o:p></span></p>
<p class=MsoPlainText style='tab-stops:list .5in'><span style='font-family:
Verdana;mso-fareast-font-family:"MS Mincho"'><![if !supportEmptyParas]>&nbsp;<![endif]><o:p></o:p></span></p>
<p class=MsoPlainText style='margin-left:.5in;text-indent:-.25in;mso-list:l0 level1 lfo4;
tab-stops:list .5in'><![if !supportLists]><span style='font-family:Verdana;
mso-fareast-font-family:"MS Mincho"'>7.<span style='font:7.0pt "Times New Roman"'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
</span></span><![endif]><span style='font-family:Verdana;mso-fareast-font-family:
"MS Mincho"'>Double-click one of the instances to go to the single object view
for that instance. At this point, the custom view available for instances of
this class is recognized and the &quot;Views&quot; menu-option under the
&quot;Views&quot; button becomes enabled. <o:p></o:p></span></p>
<p class=MsoPlainText style='text-indent:.75in;tab-stops:list .5in'><span
style='font-family:Verdana;mso-fareast-font-family:"MS Mincho"'><![if !supportEmptyParas]>&nbsp;<![endif]><o:p></o:p></span></p>
<p class=MsoPlainText style='margin-left:.5in;text-indent:-.25in;mso-list:l0 level1 lfo4;
tab-stops:list .5in'><![if !supportLists]><span style='mso-fareast-font-family:
"MS Mincho"'>8.<span style='font:7.0pt "Times New Roman"'>&nbsp;&nbsp;&nbsp; </span></span><![endif]><span
style='font-family:Verdana;mso-fareast-font-family:"MS Mincho"'>Click the
&quot;Views&quot; button and select &quot;Views...&quot; in the menu.<span
style="mso-spacerun: yes"><EFBFBD> </span>A dialog is displayed with a list of the
available views for this object.<span style="mso-spacerun: yes"><EFBFBD> </span>One of
them is the &quot;Custom View of Win32_LogicalDisk&quot; which is implemented
by our sample ocx. Selecting this option and clicking &quot;OK&quot; displays
the custom view showing (in this example) the total vs free disk space on the
current disk object.</span><span style='mso-fareast-font-family:"MS Mincho"'><o:p></o:p></span></p>
<p class=MsoNormal style='tab-stops:list .5in'><br>
<strong><span style='font-family:Verdana;font-weight:normal'>General Notes</span></strong><strong><span
style='font-family:Verdana;mso-fareast-font-family:"MS Mincho";font-weight:
normal'><o:p></o:p></span></strong></p>
<p class=MsoNormal style='tab-stops:list .5in'><strong><span style='font-family:
Verdana;mso-fareast-font-family:"MS Mincho";font-weight:normal'><![if !supportEmptyParas]>&nbsp;<![endif]><o:p></o:p></span></strong></p>
<p class=MsoPlainText style='tab-stops:list .5in'><span style='font-family:
Verdana;mso-fareast-font-family:"MS Mincho";mso-bidi-font-family:"Times New Roman"'>Things
to remember when you're building your own WMI client application:<o:p></o:p></span></p>
<p class=MsoPlainText style='tab-stops:list .5in'><span style='font-family:
Verdana;mso-fareast-font-family:"MS Mincho";mso-bidi-font-family:"Times New Roman"'><![if !supportEmptyParas]>&nbsp;<![endif]><o:p></o:p></span></p>
<p class=MsoPlainText style='margin-left:.25in;text-indent:-.25in;mso-list:
l1 level1 lfo6;tab-stops:list .25in .5in'><![if !supportLists]><span
style='font-family:"Times New Roman";mso-fareast-font-family:"MS Mincho"'>1.<span
style='font:7.0pt "Times New Roman"'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
</span></span><![endif]><span style='font-family:Verdana;mso-fareast-font-family:
"MS Mincho";mso-bidi-font-family:"Times New Roman"'>If you want your client to
run on NT and non-DCOM versions of Windows 95, manually load the ole32.dll and
see if CoInitializeSecurity() exists. This routine won<6F>t exist on Windows 95
installations that don<6F>t have DCOM installed separately. If this routine doesn't
exist, the asynchronous routines in this sample won<6F>t work because of
mismatched security level problems. The synchronous techniques will still work.<o:p></o:p></span></p>
<p class=MsoPlainText style='tab-stops:list .5in'><span style='font-family:
Verdana;mso-fareast-font-family:"MS Mincho";mso-bidi-font-family:"Times New Roman"'><![if !supportEmptyParas]>&nbsp;<![endif]><o:p></o:p></span></p>
<p class=MsoPlainText style='margin-left:.25in;text-indent:-.25in;mso-list:
l1 level1 lfo6;tab-stops:list .25in .5in'><![if !supportLists]><span
style='font-family:"Times New Roman";mso-fareast-font-family:"MS Mincho"'>2.<span
style='font:7.0pt "Times New Roman"'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
</span></span><![endif]><span style='font-family:Verdana;mso-fareast-font-family:
"MS Mincho";mso-bidi-font-family:"Times New Roman"'>If you don<6F>t care about
non-DCOM versions of Windows 95, you can define<span style="mso-spacerun:
yes"><EFBFBD> </span>_WIN32_DCOM so that CoInitializeSecurity() is available for
implicit linking. Don't use _WIN32_WINNT to get this prototype since it won't
compile under the Windows 95/98 operating systems.<o:p></o:p></span></p>
<p class=MsoPlainText style='tab-stops:list .5in'><span style='font-family:
Verdana;mso-fareast-font-family:"MS Mincho";mso-bidi-font-family:"Times New Roman"'><![if !supportEmptyParas]>&nbsp;<![endif]><o:p></o:p></span></p>
<p class=MsoPlainText style='margin-left:.25in;text-indent:-.25in;mso-list:
l1 level1 lfo6;tab-stops:list .25in .5in'><![if !supportLists]><span
style='font-family:"Times New Roman";mso-fareast-font-family:"MS Mincho"'>3.<span
style='font:7.0pt "Times New Roman"'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
</span></span><![endif]><span style='font-family:Verdana;mso-fareast-font-family:
"MS Mincho";mso-bidi-font-family:"Times New Roman"'>In any case, the
CoInitializeSecurity() call (in InitInstance()) is required to work around a
security problem when WMI trying to call a Sink object but won't identify
itself. The CoInitializeSecurity() call turns off the authentication
requirement. <o:p></o:p></span></p>
<p class=MsoPlainText style='tab-stops:list .5in'><span style='font-family:
Verdana;mso-fareast-font-family:"MS Mincho";mso-bidi-font-family:"Times New Roman"'><![if !supportEmptyParas]>&nbsp;<![endif]><o:p></o:p></span></p>
<p class=MsoPlainText style='margin-left:.25in;text-indent:-.25in;mso-list:
l1 level1 lfo6;tab-stops:list .25in .5in'><![if !supportLists]><span
style='font-family:"Times New Roman";mso-fareast-font-family:"MS Mincho"'>4.<span
style='font:7.0pt "Times New Roman"'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
</span></span><![endif]><span style='font-family:Verdana;mso-fareast-font-family:
"MS Mincho";mso-bidi-font-family:"Times New Roman"'>WMI interfaces are defined
in wbemcli.h and wbemprov.h found in the wmi\include directory.<span
style="mso-spacerun: yes"><EFBFBD> </span>You may #include both these files by
including just wbemidl.h located in the same directory.<o:p></o:p></span></p>
<p class=MsoPlainText style='tab-stops:list .5in'><span style='font-family:
Verdana;mso-fareast-font-family:"MS Mincho";mso-bidi-font-family:"Times New Roman"'><![if !supportEmptyParas]>&nbsp;<![endif]><o:p></o:p></span></p>
<p class=MsoPlainText style='margin-left:.25in;text-indent:-.25in;mso-list:
l1 level1 lfo6;tab-stops:list .25in .5in'><![if !supportLists]><span
style='font-family:"Times New Roman";mso-fareast-font-family:"MS Mincho"'>5.<span
style='font:7.0pt "Times New Roman"'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
</span></span><![endif]><span style='font-family:Verdana;mso-fareast-font-family:
"MS Mincho";mso-bidi-font-family:"Times New Roman"'>WMI interface CLSIDs are
defined in wbemuuid.lib. If you get unresolved externals in interfaces and
CLSIDs, this is what is missing. <o:p></o:p></span></p>
<p class=MsoPlainText style='tab-stops:list .5in'><span style='font-family:
Verdana;mso-fareast-font-family:"MS Mincho";mso-bidi-font-family:"Times New Roman"'><![if !supportEmptyParas]>&nbsp;<![endif]><o:p></o:p></span></p>
<p class=MsoPlainText style='margin-left:.25in;text-indent:-.25in;mso-list:
l1 level1 lfo6;tab-stops:list .25in .5in'><![if !supportLists]><span
style='font-family:"Times New Roman";mso-fareast-font-family:"MS Mincho"'>6.<span
style='font:7.0pt "Times New Roman"'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
</span></span><![endif]><span style='font-family:Verdana;mso-fareast-font-family:
"MS Mincho";mso-bidi-font-family:"Times New Roman"'>You'll need to link with
oleaut32.lib and ole32.lib to get the needed COM support.<o:p></o:p></span></p>
<p class=MsoPlainText style='tab-stops:list .5in'><span style='font-family:
Verdana;mso-fareast-font-family:"MS Mincho";mso-bidi-font-family:"Times New Roman"'><![if !supportEmptyParas]>&nbsp;<![endif]><o:p></o:p></span></p>
<p class=MsoPlainText style='margin-left:.25in;text-indent:-.25in;mso-list:
l1 level1 lfo6;tab-stops:list .25in .5in'><![if !supportLists]><span
style='font-family:"Times New Roman";mso-fareast-font-family:"MS Mincho"'>7.<span
style='font:7.0pt "Times New Roman"'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
</span></span><![endif]><span style='font-family:Verdana;mso-fareast-font-family:
"MS Mincho";mso-bidi-font-family:"Times New Roman"'>In the Link|Output
settings, specify 'wWinMainCRTStartup' as the entry point. This is per the
Unicode programming instructions.<o:p></o:p></span></p>
<p class=MsoPlainText style='tab-stops:list .5in'><span style='font-family:
Verdana;mso-fareast-font-family:"MS Mincho";mso-bidi-font-family:"Times New Roman"'><![if !supportEmptyParas]>&nbsp;<![endif]><o:p></o:p></span></p>
<p class=MsoPlainText style='margin-left:.25in;text-indent:-.25in;mso-list:
l1 level1 lfo6;tab-stops:list .25in .5in'><![if !supportLists]><span
style='font-family:"Times New Roman";mso-fareast-font-family:"MS Mincho"'>8.<span
style='font:7.0pt "Times New Roman"'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
</span></span><![endif]><span style='font-family:Verdana;mso-fareast-font-family:
"MS Mincho"'>If you're using the makefiles, don't forget to set the Visual C++
environment variables. This is done by running VCVARS32.BAT.<o:p></o:p></span></p>
<p class=MsoNormal style='tab-stops:list .5in'><br>
<span style='font-family:Arial'><a
href="http://www.microsoft.com/misc/CPYRIGHT.HTM"><span style='mso-field-code:
"HYPERLINK \0022http\:\/\/www\.microsoft\.com\/misc\/CPYRIGHT\.HTM\0022"'><b><EFBFBD>
1998-2001 Microsoft Corporation. All rights reserved.</b></span></a></span></p>
</div>
</body>
</html>