FREE RESOURCES:

VB Code:
  1. Const GFSR_SYSTEMRESOURCES = 0
  2. Const GFSR_GDIRESOURCES = 1
  3. Const GFSR_USERRESOURCES = 2
  4. Private Declare Function GetFreeResources Lib "RSRC32" Alias "_MyGetFreeSystemResources32@4" (ByVal lWhat As Long) As Long
  5. Private Sub Form_Load()
  6. Me.AutoRedraw = True
  7. Me.Print "Free System Resources: " + CStr(GetFreeResources(GFSR_SYSTEMRESOURCES)) + "%"
  8. Me.Print "Free GDI Resources: " + CStr(GetFreeResources(GFSR_GDIRESOURCES)) + "%"
  9. Me.Print "Free User Resources: " + CStr(GetFreeResources(GFSR_USERRESOURCES)) + "%"
  10. End Sub

GUI RESOURCES:

VB Code:
  1. Private Const GR_GDIOBJECTS = 0
  2. Private Const GR_USEROBJECTS = 1
  3. Private Declare Function GetGuiResources Lib "user32.dll" (ByVal hProcess As Long, ByVal uiFlags As Long) As Long
  4. Private Declare Function GetCurrentProcess Lib "kernel32" () As Long
  5. Private Sub Form_Load()
  6. Debug.Print "GDI objects used by this application: " & GetGuiResources(GetCurrentProcess, GR_GDIOBJECTS)
  7. Debug.Print "User objects used by this application: " & GetGuiResources(GetCurrentProcess, GR_USEROBJECTS)
  8. End Sub