会员
周边
众包
新闻
博问
闪存
所有博客
当前博客
我的博客
我的园子
账号设置
简洁模式
...
退出登录
注册
登录
13 years C/C++/C# programing, focus on embedded and mobile device development.
博客园
::
首页
::
博问
::
闪存
::
新随笔
::
联系
::
订阅
::
管理
::
公告
Windows mobile 中获取内存使用情况
Windows mobile 中获取内存使用情况
Code
using
System;
using
System.Text;
using
System.Runtime.InteropServices;
namespace
TaskManager
{
public
class
Memory
{
static
MEMORYSTATUS status
=
new
MEMORYSTATUS();
P/V invoke
#region
P/V invoke
private
struct
MEMORYSTATUS
{
public
UInt32 dwLength;
public
UInt32 dwMemoryLoad;
public
UInt32 dwTotalPhys;
public
UInt32 dwAvailPhys;
public
UInt32 dwTotalPageFile;
public
UInt32 dwAvailPageFile;
public
UInt32 dwTotalVirtual;
public
UInt32 dwAvailVirtual;
}
[DllImport(
"
CoreDll.dll
"
)]
private
static
extern
void
GlobalMemoryStatus
(
ref
MEMORYSTATUS lpBuffer
);
[DllImport(
"
CoreDll.dll
"
)]
private
static
extern
int
GetSystemMemoryDivision
(
ref
UInt32 lpdwStorePages,
ref
UInt32 lpdwRamPages,
ref
UInt32 lpdwPageSize
);
#endregion
public
static
void
UpdateStatus()
{
GlobalMemoryStatus(
ref
status);
}
public
static
UInt32 TotalPhysicalMemory
{
get
{
return
status.dwTotalPhys;
}
}
public
static
UInt32 AvilablePhysicalMemory
{
get
{
return
status.dwAvailPhys;
}
}
public
static
UInt32 TotalVirtualMemory
{
get
{
return
status.dwTotalVirtual;
}
}
public
static
UInt32 AvilableVirtualMemory
{
get
{
return
status.dwAvailVirtual;
}
}
public
static
UInt32 TotalPageFile
{
get
{
return
status.dwTotalPageFile;
}
}
public
static
UInt32 AvilablePageFile
{
get
{
return
status.dwAvailPageFile;
}
}
}
}
posted on
2009-09-24 16:44
woaiusd
阅读(
569
) 评论(
1
)
编辑
收藏
举报
会员力量,点亮园子希望
刷新页面
返回顶部