« links for 2007-05-16 | 回到主頁面 | Write a simple Windows SideShow program »

May 18, 2007

Write simple WMI program


將此網頁加入【百度收藏】... 加入此網頁到【del.icio.us 書籤】 technorati


(Diagram: 淺談CIM與WMI-名詞介紹)

WMI (Windows Management Instrumentation) provide a kind of easy way to let you query data from your system (Ex: OS version, share folder name ... etc).

It is easy to understand, using WMI to query information is the same with query data from database. You can just using "SELECT * from Win32_Process" to find out all exist process in your computer.

There are some examples which describe how to create it using C# or C++ code.

There are serveral extension reading..
Here is sample code of C#

using System.Management;

//This is equivalent to "SELECT * FROM Win32_Service"
SelectQuery sysSQL = new SelectQuery("Win32_bios");

MnagementObjectSearcher sysRet =
  
new ManagementObjectSearcher(sysSQL);

// Display each entry for Win32_bios
foreach (ManagementObject sysInfo in sysRet.Get())
{
 
this.textBox1.Text = "Bios version: " + sysInfo["version"].ToString();
}



VS2005 (俗稱的VC8)相關問題

由 Evan 發表於 May 18, 2007 將此網頁加入【百度收藏】... 加入此網頁到【del.icio.us 書籤】 technorati
引用
本文的引用網址:


以下是前來引用的連結 'Write simple WMI program' 來自 Blog E
迴響
發表迴響









記住我的資訊?




(請輸入以下的驗證碼)