Obtain memory usage in Windows Mobile

Source: Internet
Author: User
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 (RefStatus );
}

Public   Static Uint32 totalphysicalmemory
{
Get
{
ReturnStatus. dwtotalphys;
}
}

Public   Static Uint32 avilablephysicalmemory
{
Get
{
ReturnStatus. dwavailphys;
}
}

Public   Static Uint32 totalvirtualmemory
{
Get
{
ReturnStatus. dwtotalvirtual;
}
}

Public   Static Uint32 avilablevirtualmemory
{
Get
{
ReturnStatus. dwavailvirtual;
}
}

Public   Static Uint32 totalpagefile
{
Get
{
ReturnStatus. dwtotalpagefile;
}
}

Public   Static Uint32 avilablepagefile
{
Get
{
ReturnStatus. dwavailpagefile;
}
}
}
}
Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.