c++winapimfcwin32gui

GetGuiResources WIn32 API usage


I am trying to use GetGuiResources to find the Gui resources used by my program.It takes a flag as the second parameter. I am interested to know the difference between GR_USEROBJECTS and GR_GDIOBJECTS . I couldn't find any documentation around it. Can anyone explain what is the difference between them? I also know that by default maximum 10k GDI handles can be opened process at a time. Is the value returned by GR_GDIOBJECTS counted as part of this 10k limit?


Solution

  • GR_USEROBJECTS are User32 objects, windows and menus.

    GR_GDIOBJECTS are Gdi32 objects, like device contexts, fonts, bitmaps, cursors, icons, brushes, pens, regions, palettes, metafiles, paths.

    There is very little point in actually using GetGuiResources() in a program, these values are readily visible in Task Manager. View + Select Columns and tick USER Objects and GDI Objects. There ought to be a ton of web pages that talk about these counters.

    The default 10,000 handle quota is per-process. There's a limit on the total number of handles created by all processes in a session, a backgrounder can be seen in article "Pushing the Limits of Windows: USER and GDI Objects – Part 1".