end;
end.
3、獲取內存信息
可以通過Windows API函數GlobalMemoryStatus來獲得內存信息。
具體程序如下:
procedure TForm1.Button1Click(Sender: TObject);
Var
MemInfo:MEMORYSTATUS;
begin
MemInfo.dwLength:=sizeof(MEMORYSTATUS);
GlobalMemoryStatus(MemInfo);
memo1.Lines.Add(IntToStr(MemInfo.dwMemoryLoad)+’%的內存正在使用’) ;
memo1.Lines.Add(’物理內存共有’+IntToStr(MemInfo.dwTotalPhys)+’字節’);
memo1.Lines.Add(’可使用的物理內存有’+IntToStr(MemInfo.dwAvailPhys)+’字節’);
memo1.Lines.Add(’交換文件總大小為’+IntToStr(MemInfo.dwTotalPageFile)+’字節’) ;
memo1.Lines.Add(’尚可交換文件大小為’+IntToStr(MemInfo.dwAvailPageFile)+’字節’);
延伸閱讀
文章來源于領測軟件測試網 http://www.kjueaiud.com/