注册 登录
编程论坛 Delphi论坛

用什么代码获取系统信息???

wsx87 发布于 2007-06-19 19:41, 654 次点击
用什么代码获取系统信息?能不能做一个给我这个初学者看一下看啊
谢谢!!
3 回复
#2
anthony6342007-06-20 17:28

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.

#3
wsx872007-06-20 23:10

谢谢,以上楼主,我先先试试

#4
wsx872007-06-20 23:12

谢谢,以上楼主,我先试试

1