How to check RAM memory on 64 bit windows XP

S

snow

Hi All,

I used GlobalMemoryStatus API function checking RAM memory in my
windows application, it worked fine. Recently there are some 64 bit
Windows XP user complain that they got error message from memory
check. How can I check 64 bit windows correctly?

Thanks!
 
H

Herfried K. Wagner [MVP]

snow said:
I used GlobalMemoryStatus API function checking RAM memory in my
windows application, it worked fine. Recently there are some 64 bit
Windows XP user complain that they got error message from memory
check.

Post your function declaration and function call.
 
M

Michel Posseth [MCP]

I understood you would better use the ex function



Public Structure MEMORYSTATUSEX
Public dwLength As Integer
Public dwMemoryLoad As Integer
Public ullTotalPhys As ULong
Public ullAvailPhys As ULong
Public ullTotalPageFile As ULong
Public ullAvailPageFile As ULong
Public ullTotalVirtual As ULong
Public ullAvailVirtual As ULong
Public ullAvailExtendedVirtual As ULong
End Structure

<DllImport("kernel32.dll", SetLastError := True)> _
Private Shared Function GlobalMemoryStatusEx(ByRef lpBuffer As
MEMORYSTATUSEX) As Boolean
End Function

'
Public Function GetTotalMemory() As ULong
Dim memStat As New MEMORYSTATUSEX()
memStat.dwLength = 64
Dim b As Boolean = GlobalMemoryStatusEx(memStat)
Return memStat.ullTotalPhys
End Function



regards

Michel
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top