How do u get the amountof resources left on ur system?
I've looked everywhere, I cant find 1 that works!
Printable View
How do u get the amountof resources left on ur system?
I've looked everywhere, I cant find 1 that works!
Hi,
Try the API "FreeResource".
The syntax is:
Public Declare Function FreeResource Lib "kernel32" Alias "FreeResource" (ByVal hResData As Long) As Long
I couldn't find any documentation on it. Let me know if it works.
is this what you want?
put this code in a form module with a command button
Public Type MEMORYSTATUS
dwLength As Long
dwMemoryLoad As Long
dwTotalPhys As Long
dwAvailPhys As Long
dwTotalPageFile As Long
dwAvailPageFile As Long
dwTotalVirtual As Long
dwAvailVirtual As Long
End Type
Public Declare Sub GlobalMemoryStatus Lib "kernel32" (lpBuffer As _
MEMORYSTATUS)
Private Sub Command1_Click()
Dim strMystring As String
Dim MS As MEMORYSTATUS
MS.dwLength = Len(MS)
GlobalMemoryStatus MS
' MS.dwMemoryLoad contains percentage memory used
' MS.dwTotalPhys contains total amount of physical memory in bytes
' MS.dwAvailPhys contains available physical memory
' MS.dwTotalPageFile contains total amount of memory in the page file
' MS.dwAvailPageFile contains available amount of memory in
' the page file
' MS.dwTotalVirtual contains total amount of virtual memory
' MS.dwAvailVirtual contains available virtual memory
strMystring = "MemoryLoad = " & Str(MS.dwMemoryLoad) & " percentage memory used" & vbCrLf
strMystring = strMystring & "TotalPhys = " & Str(MS.dwTotalPageFile) & " total amount of physical memory in bytes" & vbCrLf
strMystring = strMystring & "AvailPhys = " & Str(MS.dwAvailPhys) & " available physical memory" & vbCrLf
strMystring = strMystring & "TotalPageFile = " & Str(MS.dwTotalPageFile) & " total amount of memory in the page file" & vbCrLf
strMystring = strMystring & "AvailPageFile = " & Str(MS.dwAvailPageFile) & " available amount of memory in the page file" & vbCrLf
strMystring = strMystring & "TotalVirtual = " & Str(MS.dwTotalVirtual) & " total amount of virtual memory" & vbCrLf
strMystring = strMystring & "AvailVirtual = " & Str(MS.dwAvailVirtual) & " ins available virtual memory" & vbCrLf
strMystring = strMystring & "Hi"
MsgBox strMystring, vbInformation, "Hi"
End Sub
you might have to fix the word wrap. I don't know how you show Code Text?
-William
Yeah william that is exactly what I was looking for.
Allthough the API call sounds alot simpler, cause i can implament it into a progress bar.
I dont know what to put into hResData
I dont know what to put into hResData either?
Hi,
Just a thought......maybe hResData returns the amt of free space on the system.
Hi,
Try the API "GlobalMemoryStatus" instead. It retrieves both the total memory and the usused memory.
Check
http://www.vbapi.com/ref/g/globalmemorystatus.html
for more info.
Hope this works!