Find Code:
All Words
Any of the Words
Exact Phrase
Home
:
Code
:
Forums
:
Submit
:
Mailing List
:
About
:
Contact
Code
All
VB.NET
ASP.NET
C#
VB Classic
ASP Classic
Snippets
Popular
Resources
Submit Code
Forums
Articles
Tips
Links
Books
Contest
Link to us
This code sample uses the GlobalMemoryStatus API t...
Author:
ACS
Website:
http://www.skilton.net/index.htm
Submitted:
5/7/2000
Version:
VB5
Compatibility:
VB5, VB6
Category:
Windows API
Views:
16962
This code sample uses the GlobalMemoryStatus API to return the amount of free memory in windows.
Declarations:
Public Declare Sub GlobalMemoryStatus Lib "kernel32" _ Alias "GlobalMemoryStatus" (lpBuffer As MEMORYSTATUS) 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 Global Mem as MEMORYSTATUS
Code:
'Add this code to get the values: Mem.dwLength = Len(Mem) GlobalMemoryStatus Mem 'After calling the GlobalMemoryStatus API, 'you can use the MEMORYSTATUS type to access 'the memory information: 'Mem.dwMemoryLoad contains percentage memory used 'Mem.dwTotalPhys - total amount of physical memory 'Mem.dwAvailPhys - available amount of physical memory 'Mem.dwTotalPageFile - total amount of memory in swap file 'Mem.dwAvailPageFile - available amount of memory in swap file 'Mem.dwTotalVirtual - total amount of virtual memory 'Mem.dwAvailVirtual - available amount of virtual memory 'You can use the following to set the caption 'of Label1 to the amount of physical memory available: Label1.Caption = Str(Mem.dwAvailPhys)
Home
|
Forums
|
Submit
|
Books
|
Mailing List
|
Advertising
|
About
|
Contact
© 2024 A1VBCode. All rights reserved.
Legal disclaimer & terms of use
Privacy statement