this site the web

460..ကြန္ပ်ဴတာ တစ္ခုအတြင္းမွာ ရိွေသာ Services မ်ားကို ေဖာ္ထုတ္ေသာ နည္း

 
// IMPORTANT: Add 'System.Management' to
// your References in your Project

using System;
using System.IO;
using System.Management;
namespace ListServices
{
///
/// Summary description for Class1.
///

class Class1
{
///
/// The main entry point for the application.
///

[STAThread]
static void Main(string[] args)
{
ManagementObjectSearcher query;
ManagementObjectCollection queryCollection = null;
System.Management.ObjectQuery oq;
string strComputerName;
string strQuery = "SELECT * FROM Win32_Service";
Console.WriteLine( "Check out http://www.mr-programmer.com for more samples, components and software\r\n" );
// Ask for a computer name
do
{
Console.Write( "Please enter server name (type 'localhost' for local machine): " );
strComputerName = Console.ReadLine();
} while( strComputerName == "" );
// Connect to the remote computer
ConnectionOptions co = new ConnectionOptions();
if (strComputerName.Trim().Length == 0)
{
Console.WriteLine("Must enter machine IP address or name.");
return;
}
//Point to machine
System.Management.ManagementScope ms = new System.Management.ManagementScope("\\\\" + strComputerName + "\\root\\cimv2", co);
//Query remote computer across the connection
oq = new System.Management.ObjectQuery(strQuery);
query = new ManagementObjectSearcher(ms,oq);
try
{
queryCollection = query.Get();
}
catch (Exception e1)
{
Console.WriteLine( "Error: " + e1 );
}
foreach ( ManagementObject mo in queryCollection )
{
//create child node for operating system
Console.WriteLine( mo["Name"].ToString() + " [" + mo["StartMode"].ToString() + "]" );
}
}
}
}

Ref: Mr Programmer





Labels: , ,

Print ပဲထုပ်ပါ..pdf ထုပ်လျှင်.ဖောင့်လွဲနေလိမ့်မယ်



မာတိကာ ၁ မာတိကာ ၂ မာတိကာ ၃ မာတိကာ ၄ မာတိကာ ၅

0 - ဦး မှတ်ချက်ပေးထားပါသည်

Post a Comment

KKZ Myanmar Unicode Keyboard

Mone Tine On Android

►Version 1.1

►Version 1.0

MoneTineKeyboard

Like လုပ်ထားနိုင်ပါတယ်

Mone Tine Knowledge Bank

Labels

အောက်ကကြေငြာလေးကလစ်ပေးပါဦး

Usage Policies

သင်၏ Facebook  တွင် ဖတ်နိုင်ရန် LIKE လုပ်ခဲ့ပါ..
( အမှန်ခြစ် ပေါ်နေပြီး LIKE ပြီးသားပါက CLOSE ကိုသာနှိပ် ပိတ်ပါ )

ကျေးဇူးတင်ပါတယ် မုန်တိုင်း

ကျန်းမာကြပါစေ