Windows Mobile process viewer development (4)-view memory, internal storage and memory card usage

Source: Internet
Author: User

The content of the first three lectures is not detailed, because it was previously done, so we probably copied it.CodeI also learned some of the functions to be implemented, so I will give them a little more details.

 

Function used to obtain the current storage Information

 

Bool winapi globalmemorystatus (_ inout lpmemorystatusex lpbuffer );

 

Lpbuffer is a memorystatus struct that obtains the current storage information.

 

Typedef struct _ memorystatus {
DWORD dwlength;
DWORD dwmemoryload;
DWORD dwtotalphys;
DWORD dwavailphys;
DWORD dwtotalpagefile;
DWORD dwavailpagefile;
DWORD dwtotalvirtual;
DWORD dwavailvirtual;
} Memorystatus, * lpmemorystatus;

Public partial class memorystatus: Form <br/>{< br/> public struct memoryinfo {<br/> Public int dwlength; <br/> Public int dwmemoryload; <br/> Public int dwtotalphys; <br/> Public int dwavailphys; <br/> Public int dwtotalpagefile; <br/> Public int dwavailpagefile; <br/> Public int dwtotalvirtual; <br/> Public int dwavailvirtual; <br/>}; </P> <p> Public memorystatus () <br/>{< br/> initializecomponent (); <br/> initial (); <br/>}</P> <p> private void menuitem#click (Object sender, eventargs E) <br/>{< br/> This. close (); <br/>}</P> <p> private void initial () // initialization to obtain storage Information <br/>{< br/> memoryinfo MMS; // defined memory information struct <br/> MMS = new memoryinfo (); <br/> globalmemorystatus (ref MMS); <br/> // totalvirtual. TEXT = MMs. dwmemoryload. tostring () + "% memory in use"; <br/> totalvirtual. TEXT = (float) MMs. dwtotalvirtual/1024/1024 ). tostring ("0.00") + "MB"; <br/> totalphys. TEXT = (float) MMs. (dwtotalphys/1024/1024 ). tostring ("0.00") + "MB"; <br/> availphys. TEXT = (float) MMs. (dwavailphys/1024/1024 ). tostring ("0.00") + "MB"; <br/> availvirtual. TEXT = (float) MMs. dwavailvirtual/1024/1024 ). tostring ("0.00") + "MB"; <br/> usephys. TEXT = (float) MMs. dwtotalphys-MMS. dwavailphys)/1024/1024 ). tostring ("0.00") + "MB"; <br/> usevirtual. TEXT = (float) MMs. dwtotalvirtual-MMS. dwavailvirtual)/1024/1024 ). tostring ("0.00") + "MB"; <br/>}</P> <p> [dllimport ("coredll. DLL ", setlasterror = true)] <br/> Public static extern void globalmemorystatus (ref memoryinfo buffer); </P> <p>}

 

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.