2

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.

Restore the Data Dumps
  • 38,967
  • 12
  • 96
  • 122
wintermute
  • 433
  • 2
  • 12

1 Answers1

1

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
  • 66,480
  • 18
  • 94
  • 155
  • 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 Feb 08 '10 at 11:45
  • Then the AvailablePhysical is the Property you would look at. That's the value returned from the GlobalMemoryStatus API. – ctacke Feb 08 '10 at 13:23
  • Hey, thanks for your help! I ended up by getting storage via GetDiskFreeSpaceEx and programs using OpenNETCF's MemoryManagement MemoryLoad and SystemProgramMemory. – wintermute Feb 08 '10 at 17:15