jvcoach23 Posted May 31, 2005 Posted May 31, 2005 a while back I ran accross a sample app that showed the processor usage... kind of like taskman does.. but it was in the lower left hand corner of the screen and was transparent like.. it was always on top no matter what else was running. anyway.. it was kind of cool and I've learned enough I'd like to look at the code but can't find the example anymore. does anyone know what I'm talking about and if so.. can you point me to the code. thanks shannon Quote JvCoach23 VB.Net newbie MS Sql Vet
EFileTahi-A Posted May 31, 2005 Posted May 31, 2005 Ok, this is not the example you are talking about, still, it does show the CPU usage... using System.Diagnostics.PerformanceCounter class. //add this on the declarion zone protected PerformanceCounter cpuCounter; //you can add this at the form's LOAD event cpuCounter = new PerformanceCounter(); cpuCounter.CategoryName = "Processor"; cpuCounter.CounterName = "% Processor Time"; cpuCounter.InstanceName = "_Total"; /* Call this method every time you need to know the current cpu usage. */ public string getCurrentCpuUsage() { cpuCounter.NextValue()+"%"; } I hope it helps... Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.