I'm investigating a possible memory leak which is causing an "Error creating window handle" Win32Exception in my .NET 2.0 WinForms app. This is related to number of Handles and number of USER objects (most likely) so I'm trying to log these metrics the next time the exception is thrown.
HandleCount is easy to find: Process.HandleCount
.
Does anyone know how to find the Number of USER objects? (Value can be seen in a column of the Task Manager->Processes) .NET or win API functions will do.
Thanks!