Retrieve Storage and Programs Memory on .NET Compact Framework 2 and WM5
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 MemoryManagem开发者_开发知识库ent 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.
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 ("\").
精彩评论