CPU 个数,使用量
内存:大小,使用量
网卡:个数,网速,使用量

解决方案 »

  1.   

    msdn,或到微软的网站上找一下api
      

  2.   

    内存的方法:
    procedure TAboutForm.FormCreate(Sender: TObject);
    var
      Tmp: _MEMORYSTATUS;
    begin
      Font := Screen.IconFont; 
      GlobalMemoryStatus(Tmp);
      PhyTotalMemLabel.Caption := Format('%20.0n', [Tmp.dwTotalPhys/1024]);
    end;
    其他的不是很清楚,只能帮你 UP。
      

  3.   

    procedure TForm1.Button1Click(Sender: TObject);//关于内存
    var
      //定义内存信息变量
      MemInfo: MEMORYSTATUS;
    begin
    //设置内存信息长度
      MemInfo.dwLength:=sizeof(MEMORYSTATUS);
      GlobalMemoryStatus(MemInfo);
      Edit1.Text:=IntToStr(MemInfo.dwTotalPhys)+'  B';
    //系统物理内存大小
      Edit2.Text:=IntToStr(MemInfo.dwAvailPhys)+'  B';
    //当前可用物理内存
      Edit3.Text:=IntToStr(MemInfo.dwMemoryLoad)+'%';
    //物理内存使用百分比
      Edit4.Text:=IntToStr(MemInfo.dwTotalPageFile)+'  B';
    //交换文件的字节数
      Edit5.Text:=IntToStr(MemInfo.dwAvailPageFile)+'  B';
    //空闲交换文件的字节数
      Edit6.Text:=IntToStr(MemInfo.dwTotalVirtual)+'  B';
    //虚拟内存大小
      Edit7.Text:=IntToStr(MemInfo.dwAvailVirtual)+'  B';
    //可供使用的虚拟内存大小
    end;
    //等等我帮你搞搞关于CPU
      

  4.   

    procedure TForm1.Button2Click(Sender: TObject);
    var SysInfo:SYSTEM_INFO;
    begin
      GetSystemInfo(Sysinfo);
      edit1.text:=IntToStr(Sysinfo.dwNumberOfProcessors);
       //本机器中的cpu个数
      edit2.text:=IntToStr(Sysinfo.dwProcessorType);
      //本机器的处理器类型
    end;//cpu的使用率再等等
      

  5.   

    Function Cpu_CpuUseRate:integer;stdcall;//关于cpu的使用率 ,给你个函数
    var  qw:integer; //for循环变量
         SysBaseInfo: TSystem_Basic_Information;
         SysPerfInfo: TSystem_Performance_Information;
         SysTimeInfo: TSystem_Time_Information;
         status: Longint; //32位有符号整数
         dbSystemTime: Double;
         dbIdleTime: Double;
    begin
     result:=0;
     dbIdleTime:=0;
      try
        if @NtQuerySystemInformation = nil then
          NtQuerySystemInformation := GetProcAddress(GetModuleHandle('ntdll.dll'),
          'NtQuerySystemInformation');
          //getmodulehandle 如果成功返回则一个句柄到指定模块 。
          //而其中的参数是待返回句柄用的模块地址名
          //getproaddress 中的前个参数为到dll模块的句柄。后个参数为此函数的名字
          //如果getproaddress成功返回, 返回值是dll的出口函数地址
          status := NtQuerySystemInformation(0, @SysBaseInfo, SizeOf(SysBaseInfo), nil);
          if status <> 0 then Exit;
          for qw:=0 to 0 do
             begin
                 status := NtQuerySystemInformation(3, @SysTimeInfo, SizeOf(SysTimeInfo),nil);
                 if status <> 0 then Exit;
                  status := NtQuerySystemInformation(2, @SysPerfInfo, SizeOf(SysPerfInfo), nil);
                 if status <> 0 then Exit;
                if (liOldIdleTime.QuadPart <> 0) then
                     //liOldIdleTime.QuadPart详细说明一个64字节的有符号整数
                      begin
                       dbIdleTime := Li2Double(SysPerfInfo.liIdleTime) - Li2Double(liOldIdleTime);
                       dbSystemTime := Li2Double(SysTimeInfo.liKeSystemTime) - Li2Double(liOldSystemTime);
                       dbIdleTime := dbIdleTime / dbSystemTime;
                       dbIdleTime := 100 - dbIdleTime * 100/ SysBaseInfo.bKeNumberProcessors ;
                      end;
                 liOldIdleTime := SysPerfInfo.liIdleTime;
                 liOldSystemTime := SysTimeInfo.liKeSystemTime;
                 Sleep(10); //等待0.01秒钟
                 result := strtoint(FormatFloat('0',dbIdleTime));
                 if result>100
                 then result:=100;
                 if result<0
                 then result:=0;
             end;
      except
       result:=-1;
       exit;
     end;
    end;
      

  6.   

    如何统计系统物理内存总数
    -----------------------------------------------------------------------------
    function GetMemoryTotalPhys : DWord; 
    var 
      memStatus: TMemoryStatus; 
    begin 
         memStatus.dwLength := sizeOf ( memStatus ); 
         GlobalMemoryStatus ( memStatus ); 
         Result := memStatus.dwTotalPhys; 
    end;如何测试CPU的速度 
    --------------------------------------------------------------------------------
    function CPUSpeed: Double; 
    const 
      DelayTime = 500; // 时间单位是毫秒 
    var 
      TimerHi, TimerLo: DWORD; 
      PriorityClass, Priority: Integer; 
    begin 
         PriorityClass := GetPriorityClass(GetCurrentProcess); 
         Priority := GetThreadPriority(GetCurrentThread); 
         SetPriorityClass(GetCurrentProcess, REALTIME_PRIORITY_CLASS); 
         SetThreadPriority(GetCurrentThread, THREAD_PRIORITY_TIME_CRITICAL);      Sleep(10);      asm 
            dw 310Fh // rdtsc 
            mov TimerLo, eax 
            mov TimerHi, edx 
         end;      Sleep(DelayTime);      asm 
            dw 310Fh // rdtsc 
            sub eax, TimerLo 
            sbb edx, TimerHi 
            mov TimerLo, eax 
            mov TimerHi, edx 
         end;      SetThreadPriority(GetCurrentThread, Priority); 
         SetPriorityClass(GetCurrentProcess, PriorityClass);      Result := TimerLo / (1000.0 * DelayTime); 
    end;
      

  7.   

    procedure TForm1.Button1Click(Sender: TObject);//关于内存
    var
      //定义内存信息变量
      MemInfo: MEMORYSTATUS;
    begin
    //设置内存信息长度
      MemInfo.dwLength:=sizeof(MEMORYSTATUS);
      GlobalMemoryStatus(MemInfo);
      Edit1.Text:=IntToStr(MemInfo.dwTotalPhys)+'  B';
    //系统物理内存大小
      Edit2.Text:=IntToStr(MemInfo.dwAvailPhys)+'  B';
    //当前可用物理内存
      Edit3.Text:=IntToStr(MemInfo.dwMemoryLoad)+'%';
    //物理内存使用百分比
      Edit4.Text:=IntToStr(MemInfo.dwTotalPageFile)+'  B';
    //交换文件的字节数
      Edit5.Text:=IntToStr(MemInfo.dwAvailPageFile)+'  B';
    //空闲交换文件的字节数
      Edit6.Text:=IntToStr(MemInfo.dwTotalVirtual)+'  B';
    //虚拟内存大小
      Edit7.Text:=IntToStr(MemInfo.dwAvailVirtual)+'  B';
    //可供使用的虚拟内存大小
    end;
      

  8.   

    初学DELPHI, 不知道这些东西都是哪里来的.
    不能给个函数就出来了,好像在背东西一样!没意思!
      

  9.   


      二、用GlobalMemoryStatus函数获取内存使用信息
     
      MemStatus: TMEMORYSTATUS; //定义内存结构变量 
      Lbl_Memory:Tlabel; 
      MemStatus.dwLength := size of(TMEMORYSTATUS); 
      GlobalMemoryStatus(MemStatus); //返回内存使用信息 
      Lbl_Memory.Caption := format('共有内存: %d KB 可用内存: %dKB',[MemStatus.dwAvailPhys div 1024,MemStatus.dwTotalPhys div 1024]); 
      //将内存信息显示在Lbl_Memory中
     
      三、用GetSystemInfo函数获取CPU信息
     
      SysInfo: TSYSTEMINFO; 
      Lbl_CPUName:Tlabel; 
      GetSystemInfo(SysInfo);//获得CPU信息 
      case SysInfo.dwProcessorType of 
      PROCESSOR_INTEL_386:Lbl_CPUName.Caption:=format('%d%s',[SysInfo.dwNumber Of Processors,'Intel80386']); 
      PROCESSOR_INTEL_486:Lbl_CPUName.Caption:=format('%d%s',[SysInfo.dwNumber Of Processors, 'Intel 80486']); 
      PROCESSOR_INTEL_PENTIUM:Lbl_CPUName.Caption:=format('%d%s',[SysInfo.dwNumberOfProcessors, 'Intel Pentium']); 
      PROCESSOR_MIPS_R4000:Lbl_CPUName.Caption:=format('%d%s',[SysInfo.dwNumberOfProcessors, 'MIPS R4000']); 
      PROCESSOR_ALPHA_21064:Lbl_CPUName.Caption:=format('%d%s',[SysInfo.dwNumberOfProcessors, 'ALPHA 21064']); 
      end;
        //把CPU信息显示在Lbl_CPUName中。 
      

  10.   

    看看KINGRON的超级猛料
    或是HUBDOG的葵花宝典!
      

  11.   

    取得CPU的使用率    
      http://www.swissdelphicenter.ch/torry/showcode.php?id=969 
    How to get the CPU usage in percentconstSystemBasicInformation = 0;SystemPerformanceInformation = 2;SystemTimeInformation = 3;typeTPDWord = ^DWORD;TSystem_Basic_Information = packed recorddwUnknown1: DWORD;uKeMaximumIncrement: ULONG;uPageSize: ULONG;uMmNumberOfPhysicalPages: ULONG;uMmLowestPhysicalPage: ULONG;uMmHighestPhysicalPage: ULONG;uAllocationGranularity: ULONG;pLowestUserAddress: Pointer;pMmHighestUserAddress: Pointer;uKeActiveProcessors: ULONG;bKeNumberProcessors: byte;bUnknown2: byte;wUnknown3: word;end;typeTSystem_Performance_Information = packed recordliIdleTime: LARGE_INTEGER; {LARGE_INTEGER}dwSpare: array[0..75] of DWORD;end;typeTSystem_Time_Information = packed recordliKeBootTime: LARGE_INTEGER;liKeSystemTime: LARGE_INTEGER;liExpTimeZoneBias: LARGE_INTEGER;uCurrentTimeZoneId: ULONG;dwReserved: DWORD;end;varNtQuerySystemInformation: function(infoClass: DWORD;buffer: Pointer;bufSize: DWORD;returnSize: TPDword): DWORD; stdcall = nil; liOldIdleTime: LARGE_INTEGER = ();liOldSystemTime: LARGE_INTEGER = ();function Li2Double(x: LARGE_INTEGER): Double;beginResult := x.HighPart * 4.294967296E9 + x.LowPartend;procedure GetCPUUsage;varSysBaseInfo: TSystem_Basic_Information;SysPerfInfo: TSystem_Performance_Information;SysTimeInfo: TSystem_Time_Information;status: Longint; {long}dbSystemTime: Double;dbIdleTime: Double;bLoopAborted : boolean;beginif @NtQuerySystemInformation = nil thenNtQuerySystemInformation := GetProcAddress(GetModuleHandle('ntdll.dll'),'NtQuerySystemInformation');// get number of processors in the systemstatus := NtQuerySystemInformation(SystemBasicInformation, @SysBaseInfo, SizeOf(SysBaseInfo), nil);if status <> 0 then Exit;// Show some informationwith SysBaseInfo dobeginShowMessage(Format('uKeMaximumIncrement: %d'#13'uPageSize: %d'#13+'uMmNumberOfPhysicalPages: %d'+#13+'uMmLowestPhysicalPage: %d'+#13+'uMmHighestPhysicalPage: %d'+#13+'uAllocationGranularity: %d'#13+'uKeActiveProcessors: %d'#13'bKeNumberProcessors: %d',[uKeMaximumIncrement, uPageSize, uMmNumberOfPhysicalPages,uMmLowestPhysicalPage, uMmHighestPhysicalPage, uAllocationGranularity,uKeActiveProcessors, bKeNumberProcessors]));end; bLoopAborted := False;while not bLoopAborted dobegin// get new system timestatus := NtQuerySystemInformation(SystemTimeInformation, @SysTimeInfo, SizeOf(SysTimeInfo), 0);if status <> 0 then Exit;// get new CPU's idle timestatus := NtQuerySystemInformation(SystemPerformanceInformation, @SysPerfInfo, SizeOf(SysPerfInfo), nil);if status <> 0 then Exit;// if it's a first call - skip itif (liOldIdleTime.QuadPart <> 0) thenbegin// CurrentValue = NewValue - OldValuedbIdleTime := Li2Double(SysPerfInfo.liIdleTime) - Li2Double(liOldIdleTime);dbSystemTime := Li2Double(SysTimeInfo.liKeSystemTime) - Li2Double(liOldSystemTime);// CurrentCpuIdle = IdleTime / SystemTimedbIdleTime := dbIdleTime / dbSystemTime;// CurrentCpuUsage% = 100 - (CurrentCpuIdle * 100) / NumberOfProcessorsdbIdleTime := 100.0 - dbIdleTime * 100.0 / SysBaseInfo.bKeNumberProcessors + 0.5;// Show PercentageForm1.Label1.Caption := FormatFloat('CPU Usage: 0.0 %',dbIdleTime);Application.ProcessMessages;// Abort if user pressed ESC or Application is terminatedbLoopAborted := (GetKeyState(VK_ESCAPE) and 128 = 128) or Application.Terminated;end;// store new CPU's idle and system timeliOldIdleTime := SysPerfInfo.liIdleTime;liOldSystemTime := SysTimeInfo.liKeSystemTime;// wait one secondSleep(1000);end;end; procedure TForm1.Button1Click(Sender: TObject);beginGetCPUUsageend;