How to get GDI objects associated to a process

2020-03-10 05:26发布

I am investigating GDI leaks issue in one of our smart-client application. I am looking for a tool (like tasklist) to get the GDI objects associated to a process. I can see the GDI objects in taskmanager, But my requirement to capture it periodically somewhere. For example in a text file.

3条回答
Anthone
2楼-- · 2020-03-10 06:07

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.

查看更多
ゆ 、 Hurt°
3楼-- · 2020-03-10 06:11

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.

查看更多
乱世女痞
4楼-- · 2020-03-10 06:11

Use GDIView, a free tool from NirSoft.

Their description:

GDIView is a unique tool that displays the list of GDI handles (brushes, pens, fonts, bitmaps, and others) opened by every process. It displays the total count for each type of GDI handle, as well as detailed information about each handle. This tool can be useful for developers that need to trace GDI resources leak in their software.

You can save the list of GDI counters as regular, tab-delimited, comma-delimited, and tabular text files, as well as horizontal or vertical HTML file or an XML file.

查看更多
登录 后发表回答