var
Form1: TForm1;
implementation
{$R *.DFM}
procedure TForm1.Button1Click(Sender: TObject);
var DriveType:WORD; //定义驱动器类型变量
//RootPathName:lpRootPathName;
begin
DriveType:=GetDriveType(0);//获得 RootPathName所对应的驱动器的信息
//DriveType:=GetDriveType(RootPathName);
case DriveType of
0:Lbl_DriverType.Caption:='The drive type cannot be determined';
1:Lbl_DriverType.Caption:='The root directory does not exist';
DRIVE_REMOVABLE :Lbl_DriverType.Caption:='软盘驱动器';
DRIVE_FIXED:Lbl_DriverType.Caption:='硬盘驱动器';
DRIVE_REMOTE:Lbl_DriverType.Caption:='网络驱动器';
DRIVE_CDROM:Lbl_DriverType.Caption:='光盘驱动器';
DRIVE_RAMDISK:Lbl_DriverType.Caption:='内存虚拟盘';
end;;
end;
procedure TForm1.Button2Click(Sender: TObject);
var memostatus:TMEMORYSTATUS; //定义内存结构变量
begin
memostatus.dwLength:=sizeof(TMEMORYSTATUS);
GlobalMemoryStatus(memostatus); //返回内存使用信息
Label3.Caption:=format('共有内存:%d KB,可使用内存:%d KB,已使用百分比:%d',[memostatus.dwTotalPhys div 1024,memostatus.dwAvailPhys div 1024,memostatus.dwMemoryLoad]);
end;
procedure TForm1.Button3Click(Sender: TObject);
var sysinfo:TSYSTEMINFO;
begin //CPU
GetSystemInfo(sysinfo);
case sysinfo.dwProcessorType of
PROCESSOR_INTEL_386:
label5.Caption:=format('%d%s',[sysinfo.dwNumberOfProcessors,'Intel_80386']);
PROCESSOR_INTEL_486:
label5.Caption:=format('%d %s',[sysinfo.dwNumberOfProcessors,'Intel_80486']);
PROCESSOR_INTEL_PENTIUM:
label5.Caption:=format('%d %s',[sysinfo.dwNumberOfProcessors,'Intel_Pentium']);
PROCESSOR_MISP_R4000:
label5.Caption:=format('%d %s',[sysinfo.dwNumberOfProcessors,'MISP_R4000']);
PROCESSOR_ALPHA_21064:
label5.Caption:=format('%d %s',[sysinfo.dwNumberOfProcessors,'ALPHA_21064']);
end;
end;
你试试吧~ 驱动 内存 CPU 都有!