@msdn=http://search.microsoft.com/search/results.aspx?qu=$$$ @pinvoke=http://pinvoke.net/$$$.htm Summary: returns the current memory usage for the CE Win device !!!!C# Signature: [DllImport("coredll", EntryPoint="GlobalMemoryStatus", SetLastError=false)] internal static extern void GlobalMemoryStatusCE(out MemoryStatus msce); !!!!VB Signature: <DllImport("coredll.dll")> Private Shared Function GlobalMemoryStatus(ByRef ms As MEMORYSTATUS) As Int32 End Function !!!!User-Defined Types: !!!!vb Memorystatus structure Public Structure MEMORYSTATUS ''' <summary> ''' size of the structure ''' </summary> ''' <remarks> ms.dwLength = Marshal.SizeOf(ms)</remarks> Public dwLength As Int32 ''' <summary> ''' % of used ''' </summary> ''' <remarks></remarks> Public dwMemoryLoad As Int32 ''' <summary> ''' bytes of total ram ''' </summary> ''' <remarks></remarks> Public dwTotalPhys As Int32 ''' <summary> ''' bytes of currently available ram ''' </summary> ''' <remarks></remarks> Public dwAvailPhys As Int32 ''' <summary> ''' bytes in pageing (? not normally supported in Ce) ''' </summary> ''' <remarks></remarks> Public dwTotalPageFile As Int32 ''' <summary> ''' bytes in pageing (? not normally supported in Ce) ''' </summary> ''' <remarks></remarks> Public dwAvailPageFile As Int32 ''' <summary> ''' total virtual bytes can be used ''' </summary> ''' <remarks></remarks> Public dwTotalVirtual As Int32 ''' <summary> ''' current virtual bytes available ''' </summary> ''' <remarks></remarks> Public dwAvailVirtual As Int32 End Structure !!!!C# MemoryStatus structure: [StructLayout(LayoutKind.Sequential)] internal struct MemoryStatus { /// <summary> /// Size of the structure /// </summary> public int dwLength { get; set; } /// <summary> /// Percentage of memory used /// </summary> public int dwMemoryLoad { get; set; } /// <summary> /// Total size in bytes of physical memory /// </summary> public int dwTotalPhys { get; set; } /// <summary> /// Available size in bytes of physical memory /// </summary> public int dwAvailPhys { get; set; } /// <summary> /// Total size in bytes of page file memory /// </summary> public int dwTotalPageFile { get; set; } /// <summary> /// Available size in bytes of page file memory /// </summary> public int dwAvailPageFile { get; set; } /// <summary> /// Total size in bytes of virtual memory /// </summary> public int dwTotalVirtual {get; set; } /// <summary> /// Available size in bytes of virtual memory /// </summary> public int dwAvailVirtual { get; set; } } !!!!Alternative Managed API: GC.GetTotalMemory() can return the current memory in GC but no other details. !!!!Notes: Taken from openNetCF in OpenNETCF.Win32.Core !!!!Tips & Tricks: you can ignore the dwTotalPageFile and dwAvailPageFile as they are not supported under CE !!!!Sample Code: ''' <summary> ''' gets the memory status of the current ce platform ''' </summary> ''' <returns></returns> ''' <remarks></remarks> Public Shared Function GetMemory() As MEMORYSTATUS Dim ms As MEMORYSTATUS ms.dwLength = Marshal.SizeOf(ms) GlobalMemoryStatus(ms) Return ms End Function Documentation: GlobalMemoryStatus@msdn on MSDN
Edit coredll.GlobalMem...
You do not have permission to change this page. If you feel this is in error, please send feedback with the contact link on the main page.