CSDN首页 空间 新闻 论坛 Blog 下载 读书 网摘 搜索 .NET Java 视频 接项目 求职 在线学习 买书 程序员 通知
花落谁家,你作主! 盛大widget设计大赛英雄榜
CSDN社区
搜索 收藏 打印 关闭
CSDN社区 >  Delphi >  Windows SDK/API

内存----------API

楼主dialogs(满脸皱纹,身无分文)2001-06-06 20:53:00 在 Delphi / Windows SDK/API 提问

如何取本机的可用物理内存。 问题点数:20、回复次数:7Top

1 楼dialogs(满脸皱纹,身无分文)回复于 2001-06-06 21:06:00 得分 0

麻烦各位了.Top

2 楼dialogs(满脸皱纹,身无分文)回复于 2001-06-06 21:21:00 得分 0

如何取本机的可用物理内存Top

3 楼Asus(风月无边)回复于 2001-06-06 21:22:00 得分 10

VOID   GlobalMemoryStatus(  
   
          LPMEMORYSTATUS   lpBuffer   //   pointer   to   the   memory   status   structure      
        );  
  //详细的看看帮助了  
  Top

4 楼hxshanji(洪兴山鸡)回复于 2001-06-06 21:23:00 得分 10

Unit  
  Windows.Pas  
   
  Syntax  
  GlobalMemoryStatus(  
  var   lpBuffer:   TMemoryStatus {a   pointer   to   a   TMemoryStatus   structure}  
  ); {this   procedure   does   not   return   a   value}  
   
  Description  
  This   procedure   fills   a   TMemoryStatus   structure   with   information   regarding   physical   and   virtual   memory.   However,   due   to   the   nature   of   Window's   memory   management,   two   sequential   calls   to   this   function   may   yield   different   results.  
   
  Parameters  
  lpBuffer:   A   pointer   to   a   TMemoryStatus   structure   that   receives   the   information   about   physical   and   virtual   memory   status.   The   TMemoryStatus   data   structure   is   defined   as:  
   
  TMemoryStatus   =   record  
  dwLength:   DWORD; {the   size   of   the   structure   in   bytes}  
  dwMemoryLoad:   DWORD; {estimated   memory   usage}  
  dwTotalPhys:   DWORD; {the   total   amount   of   physical   memory}  
  dwAvailPhys:   DWORD; {the   available   amount   of   physical   memory}  
   
  dwTotalPageFile:   DWORD; {the   total   amount   of   swap   file   storage}  
  dwAvailPageFile:   DWORD; {the   available   amount   of   swap   file   storage}  
  dwTotalVirtual:   DWORD; {the   total   amount   of   virtual   memory}  
  dwAvailVirtual:   DWORD; {the   available   amount   of   virtual   memory}  
  end;  
   
  dwLength:   This   member   contains   the   size   of   the   structure   in   bytes,   and   must   be   set   to   SizeOf(TMemoryStatus)   before   the   call   to   GlobalMemoryStatus   is   made.  
   
  dwMemoryLoad:   Contains   a   value   between   0   and   100   indicating   the   approximate   percentage   of   memory   in   use.  
   
  dwTotalPhys:   Indicates   the   total   amount   of   physical   RAM   in   bytes.  
   
  dwAvailPhys:   Indicates   the   total   amount   of   available   physical   RAM   in   bytes.  
   
  dwTotalPageFile:   Indicates   the   maximum   amount   of   storage   space   in   the   swap   file   in   bytes,   including   both   used   space   and   available   space.   This   number   does   not   represent   the   actual   physical   size   of   the   swap   file.  
   
  dwAvailPageFile:   Indicates   the   total   amount   of   available   space   in   the   swap   file   in   bytes.  
   
  dwTotalVirtual:   Indicates   the   total   amount   of   virtual   address   space   for   the   calling   process   in   bytes.  
   
  dwAvailVirtual:   Indicates   the   total   amount   of   unreserved   and   uncommitted   space   in   the   virtual   address   space   of   the   calling   process   in   bytes.  
   
  The   Tomes   of   Delphi   3:   Win32   Core   API   Help   File   by   Larry   DiehlTop

5 楼hxshanji(洪兴山鸡)回复于 2001-06-06 21:23:00 得分 0

例子:  
  procedure   TGlobalMemoryStatusForm.ButtonGlobalMemoryStatusClick(  
      Sender:   TObject);  
  var  
      GlobalMemoryInfo   :   TMemoryStatus;     //   holds   the   global   memory   status   information  
  begin  
      {set   the   size   of   the   structure   before   the   call.}  
      GlobalMemoryInfo.dwLength   :=   SizeOf(GlobalMemoryInfo);  
   
      {retrieve   the   global   memory   status...}  
      GlobalMemoryStatus(GlobalMemoryInfo);  
   
      {and   display   the   information}  
   
      Label1.caption   :=   'Results   of   GlobalMemoryStatus:';  
      Label2.caption   :=   'Record   structure   size:   '+IntToStr(  
                                            GlobalMemoryInfo.dwLength)+'   bytes';  
      Label3.caption   :=   'Current   memory   load:   '+IntToStr(  
                                            GlobalMemoryInfo.dwMemoryLoad)+'%';  
      Label4.caption   :=   'Total   physical   memory:   '+Format('%.0n',[  
                                            GlobalMemoryInfo.dwTotalPhys/1])+'   bytes';  
      Label5.caption   :=   'Total   available   physical   memory:   '+Format('%.0n',[  
   
                                            GlobalMemoryInfo.dwAvailPhys/1])+'   bytes';  
      Label6.caption   :=   'Total   paging   file   size:   '+Format('%.0n',[  
                                            GlobalMemoryInfo.dwTotalPageFile/1])+'   bytes';  
      Label7.Caption   :=   'Total   available   paging   file   memory:   '+Format('%.0n',[  
                                            GlobalMemoryInfo.dwAvailPageFile/1])+'   bytes';  
      Label8.caption   :=   'Total   virtual   memory:   '+Format('%.0n',[  
                                            GlobalMemoryInfo.dwTotalVirtual/1])+'   bytes';  
      Label9.caption   :=   'Total   available   virtual   memory:   '+Format('%.0n',[  
   
                                            GlobalMemoryInfo.dwAvailVirtual/1])+'   bytes';  
  end;  
  Top

6 楼Musicwind(Musicwind)回复于 2001-06-06 21:24:00 得分 0

 
  参看Delphi自带的例子程序,里面有.Top

7 楼dialogs(满脸皱纹,身无分文)回复于 2001-06-06 22:00:00 得分 0

thank   you  
  Top

相关问题

  • ODBC API与内存的问题
  • 如何释放调用api函数是占有的内存?
  • 关于虚存以及内存相关的api
  • 求读取系统剩余内存和CUP的API
  • 内存
  • 内存???
  • 内存?
  • 内存?
  • 是否有API函数可清除在内存中画的图吗?
  • 是否有API函数可清除在内存中画的图吗?

关键词

  • 内存
  • virtual
  • tmemorystatus
  • structure
  • memory
  • physical
  • lpbuffer
  • total amount
  • pointer
  • dword

得分解答快速导航

  • 帖主:dialogs
  • Asus
  • hxshanji

相关链接

  • Delphi类图书
  • Delphi类源码下载
  • Delphi控件下载

广告也精彩

反馈

请通过下述方式给我们反馈
反馈
提问
网站简介|广告服务|VIP资费标准|银行汇款帐号|网站地图|帮助|联系方式|诚聘英才|English|问题报告
北京创新乐知广告有限公司 版权所有, 京 ICP 证 070598 号
世纪乐知(北京)网络技术有限公司 提供技术支持
Copyright © 2000-2008, CSDN.NET, All Rights Reserved
GongshangLogo