This print for content only-size & color not accurate 7" X 9-1/4" / casebound / malloy



Download 21,46 Mb.
Pdf ko'rish
bet1090/1830
Sana28.09.2021
Hajmi21,46 Mb.
#188411
1   ...   1086   1087   1088   1089   1090   1091   1092   1093   ...   1830
Bog'liq
[book] [en] Pro C# 2008 and the NET 3.5 Platform Fourth Edition

Enumerating Running Processes

To illustrate the process of manipulating Process types (pardon the redundancy), assume you have

a C# Console Application named ProcessManipulator that defines the following static helper

method within the Program class (be sure you import the System.Diagnostics namespace):

static void ListAllRunningProcesses()

{

// Get all the processes on the local machine.

Process[] runningProcs = Process.GetProcesses(".");

// Print out PID and name of each process.

foreach(Process p in runningProcs)

{

string info = string.Format("-> PID: {0}\tName: {1}",



p.Id, p.ProcessName);

Console.WriteLine(info);

}

Console.WriteLine("************************************\n");



}

Notice how the static Process.GetProcesses() method returns an array of Process types that

represent the running processes on the target machine (the dot notation shown here represents the

local computer). Once you have obtained the array of Process types, you are able to trigger any of

the members seen in Table 17-2. Here, you are simply displaying the PID and the name of each

process. Assuming the Main() method has been updated to call ListAllRunningProcesses(), you

will see something like the output shown in Figure 17-3.

C H A P T E R   1 7  



P R O C E S S E S, A P P D O M A I N S, A N D   O B J E C T C O N T E X T S



565

8849CH17.qxd  10/9/07  4:29 PM  Page 565




Figure 17-3.

Enumerating running processes


Download 21,46 Mb.

Do'stlaringiz bilan baham:
1   ...   1086   1087   1088   1089   1090   1091   1092   1093   ...   1830




Ma'lumotlar bazasi mualliflik huquqi bilan himoyalangan ©hozir.org 2024
ma'muriyatiga murojaat qiling

kiriting | ro'yxatdan o'tish
    Bosh sahifa
юртда тантана
Боғда битган
Бугун юртда
Эшитганлар жилманглар
Эшитмадим деманглар
битган бодомлар
Yangiariq tumani
qitish marakazi
Raqamli texnologiyalar
ilishida muhokamadan
tasdiqqa tavsiya
tavsiya etilgan
iqtisodiyot kafedrasi
steiermarkischen landesregierung
asarlaringizni yuboring
o'zingizning asarlaringizni
Iltimos faqat
faqat o'zingizning
steierm rkischen
landesregierung fachabteilung
rkischen landesregierung
hamshira loyihasi
loyihasi mavsum
faolyatining oqibatlari
asosiy adabiyotlar
fakulteti ahborot
ahborot havfsizligi
havfsizligi kafedrasi
fanidan bo’yicha
fakulteti iqtisodiyot
boshqaruv fakulteti
chiqarishda boshqaruv
ishlab chiqarishda
iqtisodiyot fakultet
multiservis tarmoqlari
fanidan asosiy
Uzbek fanidan
mavzulari potok
asosidagi multiservis
'aliyyil a'ziym
billahil 'aliyyil
illaa billahil
quvvata illaa
falah' deganida
Kompyuter savodxonligi
bo’yicha mustaqil
'alal falah'
Hayya 'alal
'alas soloh
Hayya 'alas
mavsum boyicha


yuklab olish