Back

Topic

[KB137]Retrieving memory information with Enable Basic

Tags: Enable, Scripting, VBA

14 years ago
By RM
Options
Print
Applies to:

PcVue version 7.00 onwards.
While the basic content of this article remains valid, details may have changed since it was written.


Summary:

This article describes how to retrieve information about the current state of both physical and virtual memory.


Details:

To get information about memory, you call the GlobalMemoryStatus function which is defined in kernel SV32.dll.

Solution

  1. Copy the GlobalMemoryStatus DLL into the TP folder of your project (or into the BIN folder of the PcVue path).
  2. Run the script that is listed below. (It has been tested in Enable.)

Script

Option Explicit
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

Declare Sub GlobalMemoryStatus Lib “kernel32” (ByRef lpBuffer As MEMORYSTATUS)

Private Sub Shape1_Click()
  Dim status As MEMORYSTATUS
  status.dwLength = 32
  GlobalMemoryStatus status
  MsgBox stat.dwAvailPhys

End Sub

For further information

At the time of writing, the links at the top of this page point to the relevant articles in the book called Memory Management Reference in the online library of the Microsoft Developers Network (MSDN). Topics on related structures and functions are also available there.


Created on: 05 Nov 2010 Last update: 13 May 2024