|
-
Jul 31st, 2000, 12:43 AM
#1
Thread Starter
Fanatic Member
How do u get the amountof resources left on ur system?
I've looked everywhere, I cant find 1 that works!
ok, so... windows takes 1 minute to search for a file on my PC yet google.com takes 1 second to search the entire internet? 
-
Jul 31st, 2000, 02:55 AM
#2
Hyperactive Member
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.
-
Jul 31st, 2000, 03:56 AM
#3
Member
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
-
Aug 2nd, 2000, 05:37 PM
#4
Thread Starter
Fanatic Member
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
ok, so... windows takes 1 minute to search for a file on my PC yet google.com takes 1 second to search the entire internet? 
-
Aug 3rd, 2000, 12:49 AM
#5
Member
I dont know what to put into hResData either?
-
Aug 3rd, 2000, 03:27 AM
#6
Hyperactive Member
Hi,
Just a thought......maybe hResData returns the amt of free space on the system.
-
Aug 3rd, 2000, 03:39 AM
#7
Hyperactive Member
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!
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|