
how much available memory
Quote:
> Hello:
> This is probably an easy one but I went through two VB6 books and could
not
> find an answer. Is there a way to determine the amount of memory
available
> from within a VB6 program? I would like my program to start, load some
data
> etc and then display the available memory before the user selects certain
> parameters so they can make a choice that will not cause the program to
> exceed the available memory.
> Thanks, Gene
Hi
You must use API function, for example as below:
Private 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
Private Declare Sub GlobalMemoryStatus Lib "kernel32" (lpBuffer As
MEMORYSTATUS)
Private Sub Form_Load()
'KPD-Team 1998
'URL: http://www.allapi.net/
Dim MemStat As MEMORYSTATUS
'retrieve the memory status
GlobalMemoryStatus MemStat
MsgBox "You have" + Str$(MemStat.dwTotalPhys / 1024) + " Kb total memory
and" + Str$(MemStat.dwAvailPageFile / 1024) + " Kb available PageFile
memory."
End Sub
Best Regards
PawelT.