Results 1 to 6 of 6

Thread: RAM stats would be nice

  1. #1

    Thread Starter
    New Member
    Join Date
    Aug 2000
    Posts
    9

    Lightbulb

    Looking for a way to find out how much available RAM is left on system or how much is being used in NT.

    Thanks,
    John

  2. #2
    Hyperactive Member WP's Avatar
    Join Date
    Aug 2000
    Location
    Belgium
    Posts
    278
    I dont know if it will work in NT:

    Code:
    Private Declare Sub GlobalMemoryStatus Lib "Kernel32" (lpBuffer As MEMORYSTATUS)
    
    Type MEMORYSTATUS
        dwLength        As Long ' sizeof(MEMORYSTATUS)
        dwMemoryLoad    As Long ' percent of memory in use
        dwTotalPhys     As Long ' bytes of physical memory
        dwAvailPhys     As Long ' free physical memory bytes
        dwTotalPageFile As Long ' bytes of paging file
        dwAvailPageFile As Long ' free bytes of paging file
        dwTotalVirtual  As Long ' user bytes of address space
        dwAvailVirtual  As Long ' free user bytes
    End Type
    Public MemInfo As MEMORYSTATUS
    
    Private Sub Command1.Click()
    
    MemInfo.dwLength = Len(MemInfo)
    Call GlobalMemoryStatus(MemInfo)
    MsgBox MemInfo.dwAvailPhys
    
    End Sub
    WP

    Visual Basic 6.0 EE SP5 / .Net
    Windows XP

  3. #3

    Thread Starter
    New Member
    Join Date
    Aug 2000
    Posts
    9
    Worked fine thanks a lot just changed one thing to private.


    Private Declare Sub GlobalMemoryStatus Lib "Kernel32" (lpBuffer As MEMORYSTATUS)

    Private Type MEMORYSTATUS
    dwLength As Long ' sizeof(MEMORYSTATUS)
    dwMemoryLoad As Long ' percent of memory in use
    dwTotalPhys As Long ' bytes of physical memory
    dwAvailPhys As Long ' free physical memory bytes
    dwTotalPageFile As Long ' bytes of paging file
    dwAvailPageFile As Long ' free bytes of paging file
    dwTotalVirtual As Long ' user bytes of address space
    dwAvailVirtual As Long ' free user bytes
    End Type

    Dim MemInfo As MEMORYSTATUS


    Private Sub Command1_Click()

    MemInfo.dwLength = Len(MemInfo)
    Call GlobalMemoryStatus(MemInfo)
    MsgBox MemInfo.dwAvailPhys

    End Sub

  4. #4
    Hyperactive Member WP's Avatar
    Join Date
    Aug 2000
    Location
    Belgium
    Posts
    278
    PS if you want to write code, use the
    Code:
     &
    functions (thea will be more surveyable

    WP

    Visual Basic 6.0 EE SP5 / .Net
    Windows XP

  5. #5
    Hyperactive Member dsy5's Avatar
    Join Date
    Jul 2000
    Location
    Lockport, NY
    Posts
    362
    to post code:

    [code] Your code goes here... [/code]
    Donald Sy - VB (ab)user

  6. #6
    Lively Member
    Join Date
    Apr 2000
    Posts
    110

    Wink nice

    Nice. I've never come across that function before

    Later

    REM
    "Innovate, don't immitate."

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