Thanks to this question (the question answered my question allready!)
http://stackoverflow.com/questions/19314013/determine-number-of-gdi-handles-and-user-objects
I created this code, and it gives me exactly the count that is needed.
[System.Runtime.InteropServices.DllImport("User32")]
private extern static int GetGuiResources(IntPtr hProcess, int uiFlags);
public static int UserObjects()
{
using (var process = System.Diagnostics.Process.GetCurrentProcess())
{
var userHandles = GetGuiResources(process.Handle, 1);
return Convert.ToInt32(userHandles);
}
}
And yes, I do know I have to correct my code, but I do need this code to test whether I'm moving in the right direction!
Thanks for the efforts to help me!