views:

138

answers:

1

Hi!

I've been looking for quite a while already and still couldn't find a solution for this. All I need is to retrieve the memory levels and percentage of use. OpenNETCF has a MemoryManagement class, which seems to encapsulates a data structure returned through a P/Invoke or something like that, and it gives me the TotalPhysicalMemory, TotalVirtualMemory, AvailablePhisicalMemory and such, but those do not directly relate to Storage and Programs, nor could I find a way to "convert" these attributes to those I need.

Has anyone there already done this? It must be easy, I just need the very same values available on Settings > System > Memory.

Thanks in advance!

edit: I'm already being able to retrieve Available and total Storage memory through the GetDiskFreeSpaceEx P/Invoke. Since Storage and Programs memory seem to rely into the same hardware, maybe it's just a case of finding out what path to pass as the method's first parameter.

+1  A: 

You want the MemoryManagement class, not the DeviceManagement class. SystemStorageMemory and SystemProgramMemory are likely the properties you're after.

EDIT 1 For storage space, you'd use the DriveInfo class, initialized to the device root ("\").

ctacke
I already had a look into it, seems nice, but I'd still need to find out how much of those values is "free memory", since that's the most important in this case.
wintermute
Then the AvailablePhysical is the Property you would look at. That's the value returned from the GlobalMemoryStatus API.
ctacke
Hey, thanks for your help! I ended up by getting storage via GetDiskFreeSpaceEx and programs using OpenNETCF's MemoryManagement MemoryLoad and SystemProgramMemory.
wintermute