PDA

Click to See Complete Forum and Search --> : [VB/API] - Get Free/GUI Resources


Madboy
Feb 3rd, 2004, 01:59 PM
FREE RESOURCES:

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


GUI RESOURCES:

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