谢谢!!
unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls;
type
TForm1 = class(TForm)
Button1: TButton;
ListBox1: TListBox;
procedure Button1Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
procedure showMemInfo();
procedure getVerSionInfo();
end;
var
Form1: TForm1;
implementation
{$R *.dfm}
procedure TForm1.showMemInfo();
var
aMemStastus: TMemoryStatus;
begin
aMemStastus.dwLength := SizeOf(aMemStastus);
GlobalMemoryStatus(aMemStastus);
with ListBox1.Items, aMemStastus do
begin
Add('内存状态:') ;
Add('内存使用百分比' + IntToStr(dwMemoryLoad));//内存使用百分比
Add('物理内存总数' + IntToStr(dwTotalPhys));//物理内存总数
Add(IntToStr(dwAvailPhys));//空余内存
Add(IntToStr(dwTotalPageFile));//可调度页面文件总数
Add(IntToStr(dwAvailVirtual));//空余调用页面数
end; // with
end;
procedure TForm1.Button1Click(Sender: TObject);
begin
showMemInfo();
getVerSionInfo();
end;
procedure TForm1.getVerSionInfo();
var
aOSVersionInfo: TOSVersionInfo;
begin
aOSVersionInfo.dwOSVersionInfoSize := SizeOf(aOSVersionInfo);
GetVersionEx(aOSVersionInfo);
with ListBox1.Items, aOSVersionInfo do
begin
add('');
add('系统信息:');
add('主版本号:' + IntToStr(dwMajorVersion));
add('副版本号:' + IntToStr(dwMinorVersion));
case dwPlatformId of //
VER_PLATFORM_WIN32s:
add('操作系统:Windows3.1' );
VER_PLATFORM_WIN32_WINDOWS:
add('操作系统:Windows98以下' );
VER_PLATFORM_WIN32_NT:
add('操作系统:Windows2000/Nt' );
end; // case
Add('.....');
end; // with
end;
end.