One implementation of WMI (Windows Management Specification)

Source: Internet
Author: User

Introduced

This is another new book on Windows Management Instrumentation (Windows Management specification) after my last article, "My Explorer." I'm going to show you some techniques that allow you to remotely access the operating systems, services, and currently running processes of other computers on your network, if you have to have administrator privileges on those computers. I will also show you how to use WMI to start or stop a service, terminate a process, and create a process. This is the main interface of the program:

Begin

In this WMI application, I created a library wmicontrollibrary that contained four user controls. These four user controls are explorer,systeminfo,services and processes respectively. Each control has its own specific function. The following is a brief description of each control function:

Explorer control I have converted my ' my Explorer ' to a user control, which is used to display information such as drives, directories, files, etc. on your system.

SystemInfo control * This control is used to display information such as operating system and hardware data and inventory.

Services control * This control is used to display the service currently running on the system.

Process Control * This control is used to display the process currently running by the system.

(* Note: This control can be used to monitor remote systems on the local or network.) )

Each of these controls refers to the System.Management namespace to ensure that they have access to their specific system information.

Controlled State events

Some of these controls take some time to get the relevant information from the system, so I implemented an event UpdateStatus (string e) in each control. This allows each control to update the status bar of the main application form, and the user is well aware of what the control is doing.

//控制内部的代码
//声明一个Status的事件委托类型
public delegate void Status(string e);
//声明了一个更新状态的事件
public event Status UpdateStatus;
//更新状态条
UpdateStatus("Hello world.");
//主程序代码
//用参数中的字符串刷新状态条的显示文本
private void refreshStatusBar(string stringStatus)
{
  //更新状态条
  statusBarStatus.Text = stringStatus;
}

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.