Private Declare Function GetFreeSystemResources32 _
Lib "rsrc32.dll" Alias "_MyGetFreeSystemResources32@4" _
(ByVal fuSysResource As Integer) As Integer
Const ResourceTypeSystem = 0
Const ResourceTypeGDI = 1
Const ResourceTypeUser = 2
Public Function GetFreeResources(ResourceType As Integer) As Integer
On Error GoTo not_avail
GetFreeResources = GetFreeSystemResources32(ResourceType)
Exit Function
not_avail:
'Resource function is not available
GetFreeResources = -1
End Function
Private Sub Command1_Click()
End Sub
Private Sub cmdShowResources_Click()
MsgBox "System: " & GetFreeResources(ResourceTypeSystem) & vbCrLf & _
"GDI: " & GetFreeResources(ResourceTypeGDI) & vbCrLf & _
"User: " & GetFreeResources(ResourceTypeUser)
End Sub
|