Memory available

This is a discussion on Memory available within the Windows Programming forums, part of the Platform Specific Boards category; Does anyone have a suggestion as to how I would go about determining the total physical memory, available physical memory, ...

GlobalMemoryStatus

Thanks very much for your help. I did try your code and it compiled with no errors, but I am worried about this function returning the correct values. I was reading on the MSDN web site under GlobalMemoryStatus that there is a possibility that this function could return incorrect info if the machine has more than 4GB of memory. Also, they suggest to use the GlobalMemoryStatusEX for Windows 2000 and that is what I try to do, but I continue to receive errors.

Look into this thread for GlobalMemoryStatus.
I cannot find the GlobalMemoryEx function in my helpfiles.
there is a GlobalMemoryVlm, but you don't need this.

Update:
GlobalMemoryEx exists, but is not neccessary if you don't work with server systems. "Windows 95/98/Me: Unsupported." means your program will not run on these systems if you use this function.
:Update

Originally posted by ghe1 Also, when I use the GlobalMemoryStatus function, I get incorrect values returned for my virtual memory. The physical memory is pretty accurate.

Is it wrong or is it not what you expected?

For example, on Desktop Windows PCs, each process is allocated a 4GB address space. ....out of this address space, the only legally accessable range to your program is the usermode codespace available by your process.....on Windows NT based systems, this is the memory range 0x0010000 to 0x7FFEFFFF....or in decimal - 65,536 to 2,147,418,111 which is a total difference of 2,147,352,575 which is the same as the figure returned by nvoigt's return value for virtual memory (out by 1 byte....but what the hell!)

Its more probable that you have misinterpreted the meaning of this value that the possibility that it is wrong