Welcome to Dream.In.Code
Getting C# Help is Easy!

Join 136,257 C# Programmers for FREE! Get instant access to thousands of C# experts, tutorials, code snippets, and more! There are 2,189 people online right now. Registration is fast and FREE... Join Now!




Processor Speed Calculation Needed

 
Reply to this topicStart new topic

Processor Speed Calculation Needed, Please help with the code

ca_87
13 Oct, 2008 - 08:43 AM
Post #1

New D.I.C Head
*

Joined: 13 Oct, 2008
Posts: 1

Hi I'm a newbie to C# programming but I need to build an application that helps me calculate Processor Speed. I used this code

CODE

[b]// ad a reference to System.Management !
using System.Management;

public uint CPUSpeed()
{
  ManagementObject Mo = new ManagementObject("Win32_Processor.DeviceID='CPU0'");
  uint sp = (uint)(Mo["CurrentClockSpeed"]);
  Mo.Dispose();
  return sp;
}[/b]


but it says managementobject does not exist.Please help soon


P.S. can you tell me how to determine my System RAM and also access Registry keys
User is offlineProfile CardPM
+Quote Post

n8wxs
RE: Processor Speed Calculation Needed
13 Oct, 2008 - 09:39 AM
Post #2

D.I.C Regular
***

Joined: 6 Jan, 2008
Posts: 448



Thanked: 43 times
My Contributions
You need to add a reference to System.Management to your project's references.

Highlight "References" in the Solution Explorer panel and click "Add reference..."


User is offlineProfile CardPM
+Quote Post

gbertoli3
RE: Processor Speed Calculation Needed
13 Oct, 2008 - 03:29 PM
Post #3

DIC at Heart + Code
Group Icon

Joined: 23 Jun, 2008
Posts: 1,046



Thanked: 17 times
Dream Kudos: 950
My Contributions
Maybe you will find this program useful. PsychoCoder gave it to me and I haven't stopped using it. Hopefully it will help you.

Attached File  GetHardwareInfo_Code.zip ( 100.32k ) Number of downloads: 28


As for the Registry, try using the Microsoft.Win32 namespace.

Hope this helps
User is offlineProfile CardPM
+Quote Post

Fast ReplyReply to this topicStart new topic
Time is now: 12/2/08 04:29AM

Live C# Help!

C# Tutorials

Reference Sheets

C# Snippets

DIC Chatroom

Bye Bye Ads

Monthly Drawing

Thumb Drive

Top Contributors

Top 10 Kudos This Month