هذا البرنامج يقوم بعرض معلومات عن حجم الذاكرة الموجودة على جهازك سواءا العشوائية أو الافتراضية وأيضا معلومات عن حجم القرص الصلب أو أي وحدة أخرى وبعض المعلومات المتعلقة بوحدة التخزين التي تحددها في الثابت Dir
private
procedure GetHardDriveInfo;
procedure GetMemoryStatus;
//Drop ListBox onto your form and set the following Property:
// Columns = 2
// TabWidth >100
// Width >200
var
lpSectorPerCluster, lpBytePerSector : Cardinal;
lpNumberOfFreeClusters, lpTotalNumberOfClusters : Cardinal;
FreeAvailable, TotalSpace: Int64;
TotalFree: PlargeInteger;
lpBuffer: _MEMORYSTATUS;
.
.
.
procedure TForm1.GetHardDriveInfo;
const
Dir = 'C:'; //or any other storage device, prtition or network drive
begin
if ListBox1.Items.Count <> 0 then
ListBox1.Items.Add('');
if GetDiskFreeSpace(Dir, lpSectorPerCluster, lpBytePerSector,
lpNumberOfFreeClusters, lpTotalNumberOfClusters) then
begin
with ListBox1.Items do begin
Add('Sector per Clustor:'+#9+FloatToStr(lpSectorPerCluster));
Add('Byte Per Sector:'+#9+FloatToStr(lpBytePerSector));
Add('Free Clusters:'+#9+FloatToStr(lpNumberOfFreeClusters));
Add('Total Clusters:'+#9+FloatToStr(lpTotalNumberOfClusters));
end;
end;
ListBox1.Items.Add('');
GetMem(TotalFree,8);
if GetDiskFreeSpaceEx(Dir, FreeAvailable, TotalSpace, TotalFree) then
begin
with ListBox1.Items do begin
Add('Free Space:'+#9+IntToStr(FreeAvailable)+' Bytes');
Add('Capacity:'+#9+IntToStr(TotalSpace)+' Bytes');
Add('Total Free:'+#9+IntToStr(TotalFree^)+' Bytes');
Add('');
end;
end;
FreeMem(TotalFree);
end;
procedure TForm1.GetMemoryStatus;
begin
GlobalMemoryStatus(lpBuffer);
with ListBox1.Items do begin
Add('Memory Status');
Add('Memory in use'+#9+FloatToStr(lpBuffer.dwMemoryLoad)+'%');
Add('Total Physical Memory'+#9+FloatToStr(lpBuffer.dwTotalPhys)+' Bytes');
Add('Free Physical Memory'+#9+FloatToStr(lpBuffer.dwAvailPhys)+' Bytes');
Add('Paging File'+#9+FloatToStr(lpBuffer.dwTotalPageFile)+' Bytes');
Add('Free Paging File'+#9+FloatToStr(lpBuffer.dwAvailPageFile)+' Bytes');
Add('Total Virtual Address Space'+#9+FloatToStr(lpBuffer.dwTotalVirtual)+' Bytes');
Add('Free Virtual Address Space'+#9+FloatToStr(lpBuffer.dwAvailVirtual)+' Bytes');
end;
end;