views:

50

answers:

0

Hi,

I'm trying to add the info from GetGuiResources to the exception handling system of my application. Getting the values for the current process is not a big deal, but I would like to add the values for the whole system as well.

So I tried:

foreach (Process p in Process.GetProcesses())
{
   gdiHandles += GetGuiResources(p.Handle, 0);
   userHandles += GetGuiResources(p.Handle, 1);
}

But this throws an exception, because for some processes it is not allowed to access the .Handle property. So my question is, how do I get the number of used GDI and USER handles for the whole system?

tia Martin