Windows API Guide: GetSysColor Function


Declare Sub GlobalMemoryStatus Lib "kernel32.dll" (lpBuffer As MEMORYSTATUS)

Platforms

  • Windows 95: Supported.
  • Windows 98: Supported.
  • Windows NT: Requires Windows NT 3.1 or later.
  • Windows 2000: Supported but Obsolete; use GlobalMemoryStatusEx instead.
  • Windows CE: Unknown.

Description & Usage

GlobalMemoryStatus retrieves the current status of the computer's memory. It reports both the total memory available and the amount of unused memory. This function only works properly on computers with no more than 4 GB of memory. If the computer has more than 4 GB of memory, the values reported by GlobalMemoryStatus are the actual values modulo 4 (for example, a computer with 5 GB total memory would be reported as having only 1 GB of memory). For computers with more than 4 GB of memory, use the GlobalMemoryStatusEx function instead.

Return Value

GlobalMemoryStatusEx does not return a value.

Visual Basic-Specific Issues

None.

Parameters

lpBuffer
Receives the current status of the computer's memory. The dwLength member of the structure does not have to be set before calling the function.

Example

' This code is licensed according to the terms and conditions listed here. ' Display the amounts of total and available physical memory ' on the computer.  Also calculate the percentage of used physical memory. Dim ms As MEMORYSTATUS ' Get the current memory status. GlobalMemoryStatus ms ' Display total and available physical memory, in KB. Debug.Print "Total Physical Memory:"; ms.dwTotalPhys \ 1024; "KB" Debug.Print "Available Physical Memory:"; ms.dwAvailPhys \ 1024; "KB" ' Calculate percentage of physical memory in use. Debug.Print "Used Physical Memory:"; 100 - 100 * ms.dwAvailPhys \ ms.dwTotalPhys; "%"

See Also

GlobalMemoryStatusEx

Category

Memory

Back to the Function list.
Back to the Reference section.


Last Modified: March 19, 2000
This page is copyright © 2000 Paul Kuliniewicz. Copyright Information Revised October 29, 2000
Go back to the Windows API Guide home page.
E-mail: vbapi@vbapi.com Send Encrypted E-Mail
This page is at http://www.vbapi.com/ref/g/globalmemorystatus.html



Windows API Guide
Windows API Guide - Reference - Volume 1: Version 3.0 For the MS-DOS and PC-DOS Operating Systems
ISBN: B001V0KQIY
EAN: N/A
Year: 1998
Pages: 610

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net