请问各位老兄!我在程序中用到两个函数,一个是获得内存信息函数:globalmemorystatus(meminfo);可是在编译的时候就出现错误;
还有一个是获得硬盘信息:
getdiskfreespaceex('c:',freebytesavailabletocaller,totalsize,@freesize);
也是在编译时出错!请问都是什么原因!个参数都是什么意识,什么类型!
谢谢指教1请详细讲解!万分感谢!!!

解决方案 »

  1.   

    globalmemorystatus例子
    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;
    getdiskfreespaceex例子
    procedure TForm1.Button1Click(Sender: Tobject);
    var
      SectorsPerCluster,  // holds the sectors per cluster
      BytesPerSector,     // holds the bytes per sector
      FreeClusters,       // holds the number of free clusters
      Clusters: DWORD;    // holds the total number of disk clusters
    begin
      {retrieve the disk space information}
      if GetDiskFreeSpace('C:\',SectorsPerCluster,BytesPerSector,                      FreeClusters,Clusters) then
      begin
        {display the disk space information}
        Panel2.Caption := IntToStr(SectorsPerCluster);
        Panel3.Caption := IntToStr(BytesPerSector);
        Panel4.Caption := IntToStr(FreeClusters);
        Panel5.Caption := IntToStr(Clusters);
        Panel6.Caption := IntToStr(FreeClusters*BytesPerSector*SectorsPerCluster);
        Panel7.Caption := IntToStr(Clusters*BytesPerSector*SectorsPerCluster);  end;
    end;