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>}