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



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

Investigating a Specific Process

In addition to obtaining a full and complete list of all running processes on a given machine, the

static Process.GetProcessById() method allows you to obtain a single Process type via the associ-

ated PID. If you request access to a nonexistent PID, an ArgumentException exception is thrown. For

example, if you were interested in obtaining a Process object representing a process with the PID of

987, you could write the following:



// If there is no process with the PID of 987, a

// runtime exception will be thrown.

static void GetSpecificProcess()

{

Process theProc =  null;



try

{

theProc = Process.GetProcessById(987);



}

catch  // Generic catch for used simplicity.

{

Console.WriteLine("-> Sorry...bad PID!");



}

}

Investigating a Process’s Thread Set

The Process class type also provides a manner to programmatically investigate the set of all

threads currently used by a specific process. The set of threads is represented by the strongly typed

ProcessThreadCollection collection, which contains some number of individual ProcessThread

types. To illustrate, assume the following additional static helper function has been added to your

current application:

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



566

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




static void EnumThreadsForPid(int pID)

{

Process theProc = null;



try

{

theProc = Process.GetProcessById(pID);



}

catch


{

Console.WriteLine("-> Sorry...bad PID!");

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

return;


}


Download 21,46 Mb.

Do'stlaringiz bilan baham:
1   ...   1087   1088   1089   1090   1091   1092   1093   1094   ...   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