GetGuiResources function

Retrieves the count of handles to graphical user interface (GUI) objects in use by the specified process.

Syntax

DWORD GetGuiResources(
  HANDLE hProcess,
  DWORD  uiFlags
);

Parameters

hProcess

A handle to the process. The handle must have the PROCESS_QUERY_INFORMATION access right. For more information, see Process Security and Access Rights.

uiFlags

The GUI object type. This parameter can be one of the following values.

Value Meaning
GR_GDIOBJECTS
0
Return the count of GDI objects.
GR_GDIOBJECTS_PEAK
2
Return the peak count of GDI objects.

Windows Server 2008, Windows Vista, Windows Server 2003 and Windows XP:  This value is not supported until Windows 7 and Windows Server 2008 R2.

GR_USEROBJECTS
1
Return the count of USER objects.
GR_USEROBJECTS_PEAK
4
Return the peak count of USER objects.

Windows Server 2008, Windows Vista, Windows Server 2003 and Windows XP:  This value is not supported until Windows 7 and Windows Server 2008 R2.

Return Value

If the function succeeds, the return value is the count of handles to GUI objects in use by the process. If no GUI objects are in use, the return value is zero.

If the function fails, the return value is zero. To get extended error information, call GetLastError.

Remarks

A process without a graphical user interface does not use GUI resources, therefore, GetGuiResources will return zero.

Requirements

   
Minimum supported client Windows XP [desktop apps only]
Minimum supported server Windows Server 2003 [desktop apps only]
Target Platform Windows
Header winuser.h (include Windows.h)
Library User32.lib
DLL User32.dll

See Also

CreateProcess

GetCurrentProcess

OpenProcess

Process and Thread Functions