How to get GDI objects associated to a process

The totally free Process Explorer ( http://www.sysinternals.com ) allows you to graphically inspect this and a zillion other aspects related to running processes. Add GDI Objects to the columns to display and you're off and running. The column GDI Objects can be found in the Process Memory tab in the Select Columns dialog.

NOTE: Microsoft acquired their tools and I believe Mark Russinovich now works for Microsoft. Sysinternals tools don't typically require any installation other than to copy them to somewhere convenient and should be in your toolbox if they aren't already.


It should be quite straightforward to write a program to periodically log the number of GDI handles in use by a process, using the GetGuiResources API function.