PC Review


Reply
Thread Tools Rate Thread

Get number of processors

 
 
William Stacey
Guest
Posts: n/a
 
      3rd Feb 2004
Is there a class to get the number of processors? tia

--
William Stacey



 
Reply With Quote
 
 
 
 
Jeffrey Wynn
Guest
Posts: n/a
 
      3rd Feb 2004
William,

There are a few alternatives. First, and probably the simplest, there is an
environment variable called "NUMBER_OF_PROCESSORS" on Windows 2000, Windows
20003, and Windows XP. You could use Environment class in the System
namespace as follows.

string strNumberOfProcessors = Environment.GetEnvironmentVariable(
"NUMBER_OF_PROCESSORS" );

Second, this information is also exposed via WMI which you could query using
classes in the System.Management namespace. The third alternative is to
call a Win32 API function, GetSystemInfo, via P/Invoke.

Hope this helps.
--
Jeffrey Wynn
(E-Mail Removed)

"William Stacey" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> Is there a class to get the number of processors? tia
>
> --
> William Stacey
>
>
>



 
Reply With Quote
 
Gabriele G. Ponti
Guest
Posts: n/a
 
      3rd Feb 2004
int n =
Convert.ToInt16(System.Environment.GetEnvironmentVariable("NUMBER_OF_PROCESS
ORS"));

Please note that it's not supported in Windows 95/98.


 
Reply With Quote
 
William Stacey
Guest
Posts: n/a
 
      3rd Feb 2004
Thanks to both. They should hang a property off the Environment class or
other. Cheers!

--
William Stacey, MVP

"Gabriele G. Ponti" <ggponti.at.hotmail.com> wrote in message
news:(E-Mail Removed)...
> int n =
>

Convert.ToInt16(System.Environment.GetEnvironmentVariable("NUMBER_OF_PROCESS
> ORS"));
>
> Please note that it's not supported in Windows 95/98.
>
>



 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
getting number of processors zeero Microsoft VC .NET 2 9th Feb 2008 09:23 PM
number of processors =?Utf-8?B?RmFvbA==?= Microsoft Windows 2000 Advanced Server 2 31st Jan 2005 07:54 PM
number of processors =?Utf-8?B?RmFvbA==?= Microsoft Windows 2000 0 24th Jan 2005 09:03 PM
how to get the number of processors available? AA Microsoft Dot NET 4 8th Dec 2003 01:27 PM
number of processors Tim Windows XP Hardware 4 19th Sep 2003 06:34 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 02:23 PM.