As you may know, Win_Memory_Info() is supposed to be able to return the total amount of RAM a computer has. However, for that purpose it only works on Windows XP machines, not on Win7 or Win8. As the "Win" prefix in Alpha indicates, this function makes use of an MS Windows function and it is the MS function that does not work in Win 7 or 8.

Below is an alternative function that works on XP, Win7 and Win8 (but only returns total memory). For those who may not know it is even possible, note that my function is a 2 in 1 function, i.e., the main function contains a 2nd function that is used by the main one (the 2nd one uses a Windows function). The main (top) function is really there only to convert bytes into gigabytes, something that could have been done in the 2nd function (I have my reasons to keep them separate but it is not a necessity). For the top function I have not used a "Win" prefix (Z_Win instead) because I think Alpha reserves Win_ for functions that use Windows functions and returns the raw windows information, which for memory is always in bytes.

Edit: Note that Ira Perlow has point out that a5_os_info() can also return total memory using the .TotalVisibleMemorySize property. That function and mine should both return the same number in bytes.

Raymond Lyons

'Date Created: 28-Apr-2013 05:59:40 PM
'Last Updated: 28-Apr-2013 10:44:33 PM
'Created By  : Ray lyons
'Updated By  : Ray Lyons
FUNCTION Z_Win_Total_Ram AS N ()
'Description:Get total Ram for this computer in Gigabyes
	dim ptr as P
	dim Ram_in_kb as n

'*****Function below used by one above***no need to separate them or use**********
'*****local variables. It can just be part of the above function in the Control Panel*****
FUNCTION Win_Physical_Memory AS P (computer = "." as c)
'DESCRIPTION:Retrieve the computer's physical memory in bytes
dim objWMIService as p
dim colItems as p
dim objItem as p
if computer = ""
computer = "."
end if
on error resume next
objWMIService = ole.GetObject("winmgmts:" + chr(92) + chr(92) + computer + "\root\CIMV2")
colItems = objWMIService.ExecQuery("Select * from Win32_ComputerSystem")
    For Each objItem In colItems
end function