Home All Groups Group Topic Archive Search About

Category does not exist?

Author
13 Apr 2005 10:50 AM
yxq
System.InvalidOperationException: Category does not exist.
   at System.Diagnostics.PerformanceCounterLib.CounterExists(String machine,
String category, String counter)
   at System.Diagnostics.PerformanceCounter.Initialize()
   at System.Diagnostics.PerformanceCounter.NextSample()
   at System.Diagnostics.PerformanceCounter.NextValue()
   at ProcessManager.frmMain.Timer2_Tick(Object sender, EventArgs e)
   at System.Windows.Forms.Timer.OnTick(EventArgs e)
   at System.Windows.Forms.Timer.Callback(IntPtr hWnd, Int32 msg, IntPtr
idEvent, IntPtr dwTime)

*********************************************
How to slove this problem?
Thank you

Author
13 Apr 2005 11:43 AM
Crouchie1998
Supply some code to do with Timer 2 on frmMain, which will help matters
somewhat.

Why don't you convert your Handle (Hwnd) to integer, idEvent to integer &
dwTime to either integer or double?

Again, we need your code to help you

Crouchie1998
BA (HONS) MCP MCSE
Official Microsoft Beta Tester
Author
13 Apr 2005 12:19 PM
yxq
Thank you, my code:
****************************************
For Each eachProcess As Process In Process.GetProcesses()
                    arrPro(0) = eachProcess.MainModule.ModuleName
....
Next
****************************************

Show quoteHide quote
"Crouchie1998" <crouchie1998@spamcop.net> дÈëÏûÏ¢ÐÂÎÅ:uXrPf4BQFHA.***@tk2msftngp13.phx.gbl...
> Supply some code to do with Timer 2 on frmMain, which will help matters
> somewhat.
>
> Why don't you convert your Handle (Hwnd) to integer, idEvent to integer &
> dwTime to either integer or double?
>
> Again, we need your code to help you
>
> Crouchie1998
> BA (HONS) MCP MCSE
> Official Microsoft Beta Tester
>
>
Author
13 Apr 2005 4:28 PM
Herfried K. Wagner [MVP]
"yxq" <ga***@163.net> schrieb:
> For Each eachProcess As Process In Process.GetProcesses()
>                    arrPro(0) = eachProcess.MainModule.ModuleName

'Process' is based on performance counters, if they are disabled or you
don't have rights to access them using 'Process.GetProcesses' will fail.  In
Windows 2003 you will have to add the user to a certain group in order to be
able to access performance counters:

<URL:http://groups.google.de/groups?selm=eiSs875PDHA.1072%40TK2MSFTNGP10.phx.gbl>

--
M S   Herfried K. Wagner
M V P  <URL:http://dotnet.mvps.org/>
V B   <URL:http://classicvb.org/petition/>
Author
13 Apr 2005 11:33 PM
yxq
My OS is Windows XP, how to ensure to enable performance counters?

Show quoteHide quote
"Herfried K. Wagner [MVP]" <hirf-spam-me-here@gmx.at> дÈëÏûÏ¢ÐÂÎÅ:%23Or6cXEQFHA.1***@TK2MSFTNGP12.phx.gbl...
> "yxq" <ga***@163.net> schrieb:
>> For Each eachProcess As Process In Process.GetProcesses()
>>                    arrPro(0) = eachProcess.MainModule.ModuleName
>
> 'Process' is based on performance counters, if they are disabled or you
> don't have rights to access them using 'Process.GetProcesses' will fail.
> In Windows 2003 you will have to add the user to a certain group in order
> to be able to access performance counters:
>
> <URL:http://groups.google.de/groups?selm=eiSs875PDHA.1072%40TK2MSFTNGP10.phx.gbl>
>
> --
> M S   Herfried K. Wagner
> M V P  <URL:http://dotnet.mvps.org/>
> V B   <URL:http://classicvb.org/petition/>