Results 1 to 7 of 7

Thread: System Resources? Quick question

  1. #1

    Thread Starter
    Fanatic Member invitro's Avatar
    Join Date
    Jan 2000
    Location
    Outside your window
    Posts
    547

    Talking

    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?

  2. #2
    Hyperactive Member
    Join Date
    Mar 2000
    Location
    India
    Posts
    298
    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.

  3. #3
    Member
    Join Date
    Apr 1999
    Location
    Reno, NV
    Posts
    57
    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

  4. #4

    Thread Starter
    Fanatic Member invitro's Avatar
    Join Date
    Jan 2000
    Location
    Outside your window
    Posts
    547
    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?

  5. #5
    Member
    Join Date
    Apr 1999
    Location
    Reno, NV
    Posts
    57
    I dont know what to put into hResData either?

  6. #6
    Hyperactive Member
    Join Date
    Mar 2000
    Location
    India
    Posts
    298
    Hi,

    Just a thought......maybe hResData returns the amt of free space on the system.


  7. #7
    Hyperactive Member
    Join Date
    Mar 2000
    Location
    India
    Posts
    298
    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
  •  



Click Here to Expand Forum to Full Width