You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
47 lines
930 B
47 lines
930 B
<HTML>
|
|
<HEAD>
|
|
<TITLE>Sample page showing the use of the WMIObjectBroker</TITLE>
|
|
</HEAD>
|
|
<BODY>
|
|
<br>
|
|
|
|
Click <SPAN id=ShowProcesses><b>HERE</b></SPAN> to use WMI to show a list of processes<br>
|
|
|
|
<SCRIPT LANGUAGE="JSCRIPT">
|
|
|
|
function UseLocator(locator)
|
|
{
|
|
// This function is passed a locator and displayes a message
|
|
// box that lists all running services.
|
|
var service = locator.ConnectServer();
|
|
var procs = service.InstancesOf("Win32_Process");
|
|
var f = new Enumerator(procs);
|
|
sz = "";
|
|
for (;!f.atEnd();f.moveNext())
|
|
{
|
|
var proc = f.item();
|
|
sz += proc["Name"] + "\r\n";
|
|
|
|
}
|
|
alert(sz);
|
|
}
|
|
|
|
function ShowProcesses.onclick()
|
|
{
|
|
var locator;
|
|
try
|
|
{
|
|
locator = new ActiveXObject("WbemScripting.SWbemLocator");
|
|
}
|
|
catch(e)
|
|
{
|
|
}
|
|
if(locator == null)
|
|
alert("Unable to create WMI object");
|
|
else
|
|
UseLocator(locator)
|
|
}
|
|
</SCRIPT>
|
|
|
|
</BODY>
|
|
</HTML>
|