📄 fmdemo.pas
字号:
unit FmDemo;
interface
uses
StdCtrls, Classes, Controls, ComCtrls, Forms,
PJSysInfo, ExtCtrls;
type
TDemoForm = class(TForm)
PJSysInfo1: TPJSysInfo;
TabControl1: TTabControl;
edDisplay: TMemo;
Bevel1: TBevel;
procedure FormCreate(Sender: TObject);
procedure TabControl1Change(Sender: TObject);
private
procedure DisplayRuling;
procedure DisplayRuleOff;
procedure DisplayHeading(const Title: string);
procedure DisplayItem(const Name, Value: string); overload;
procedure DisplayItem(const Name: string; const Value: Boolean); overload;
procedure DisplayItem(const Name: string; const Value: Integer); overload;
procedure DisplayItem(const Name: string; const Value: TPJOSPlatform);
overload;
procedure DisplayItem(const Name: string; const Value: TPJOSProduct);
overload;
procedure ShowContent(Tab: Integer);
procedure ShowTPJSysInfo;
procedure ShowSIRoutines;
procedure ShowWin32Globals;
procedure ShowTPJOSInfo;
procedure ShowTPJComputerInfo;
procedure ShowTPJSystemFolders;
end;
var
DemoForm: TDemoForm;
implementation
uses
SysUtils;
{$R *.DFM}
procedure TDemoForm.DisplayHeading(const Title: string);
begin
if edDisplay.Lines.Count > 0 then
edDisplay.Lines.Add('');
edDisplay.Lines.Add(Title);
end;
procedure TDemoForm.DisplayItem(const Name, Value: string);
begin
edDisplay.Lines.Add(Format('%-24s| %s', [Name, Value]));
end;
procedure TDemoForm.DisplayItem(const Name: string; const Value: Boolean);
const
cBoolean: array[Boolean] of string = ('False', 'True');
begin
DisplayItem(Name, cBoolean[Value]);
end;
procedure TDemoForm.DisplayItem(const Name: string; const Value: Integer);
begin
DisplayItem(Name, IntToStr(Value));
end;
procedure TDemoForm.DisplayItem(const Name: string; const Value: TPJOSPlatform);
const
cOSPlatform: array[TPJOSPlatform] of string = (
'ospWinNT', 'ospWin9x', 'ospWin32s'
);
begin
DisplayItem(Name, cOSPlatform[Value]);
end;
procedure TDemoForm.DisplayItem(const Name: string; const Value: TPJOSProduct);
const
cOSProduct: array[TPJOSProduct] of string = (
'osUnknownWinNT', 'osWinNT', 'osWin2K', 'osWinXP', 'osUnknownWin9x',
'osWin95', 'osWin98', 'osWinMe', 'osUnknownWin32s', 'osWinSvr2003',
'osUnknown', 'osWinVista'
);
begin
DisplayItem(Name, cOSProduct[Value]);
end;
procedure TDemoForm.DisplayRuleOff;
begin
edDisplay.Lines.Add(StringOfChar('=', 24) + '+' + StringOfChar('=', 55));
end;
procedure TDemoForm.DisplayRuling;
begin
edDisplay.Lines.Add(StringOfChar('-', 24) + '+' + StringOfChar('-', 55));
end;
procedure TDemoForm.FormCreate(Sender: TObject);
begin
ShowContent(TabControl1.TabIndex);
end;
procedure TDemoForm.ShowContent(Tab: Integer);
begin
edDisplay.Clear;
case Tab of
0: ShowTPJComputerInfo;
1: ShowTPJSystemFolders;
2: ShowTPJOSInfo;
3: ShowWin32Globals;
4: ShowTPJSysInfo;
5: ShowSIRoutines;
end;
end;
procedure TDemoForm.ShowSIRoutines;
begin
DisplayHeading('SIGetXXX Routines ** deprecated **');
DisplayRuling;
DisplayItem('SIGetComputerName', SIGetComputerName);
DisplayItem('SIGetUserName', SIGetUserName);
DisplayRuling;
DisplayItem('SIGetCommonFilesFolder', SIGetCommonFilesFolder);
DisplayItem('SIGetProgramFilesFolder', SIGetProgramFilesFolder);
DisplayItem('SIGetSystemFolder', SIGetSystemFolder);
DisplayItem('SIGetTempFolder', SIGetTempFolder);
DisplayItem('SIGetWindowsFolder', SIGetWindowsFolder);
DisplayRuling;
DisplayItem('SIGetOSBuildNumber', SIGetOSBuildNumber);
DisplayItem('SIGetOSDesc', SIGetOSDesc);
DisplayItem('SIGetOSMajorVersion', SIGetOSMajorVersion);
DisplayItem('SIGetOSMinorVersion', SIGetOSMinorVersion);
DisplayItem('SIGetOSPlatform', SIGetOSPlatform);
DisplayItem('SIGetOSProduct', SIGetOSProduct);
DisplayItem('SIGetOSProductName', SIGetOSProductName);
DisplayItem('SIGetOSProductType', SIGetOSProductType);
DisplayItem('SIGetOSServicePack', SIGetOSServicePack);
DisplayRuleOff;
end;
procedure TDemoForm.ShowTPJComputerInfo;
begin
DisplayHeading('TPJComputerInfo Static Methods');
DisplayRuling;
DisplayItem('ComputerName', TPJComputerInfo.ComputerName);
DisplayItem('UserName', TPJComputerInfo.UserName);
DisplayItem('MAC Address', TPJComputerInfo.MACAddress);
DisplayRuleOff;
end;
procedure TDemoForm.ShowTPJOSInfo;
begin
DisplayHeading('TPJOSInfo Static Methods');
DisplayRuling;
DisplayItem('BuildNumber', TPJOSInfo.BuildNumber);
DisplayItem('Description', TPJOSInfo.Description);
DisplayItem('Edition', TPJOSInfo.Edition);
DisplayItem('IsServer', TPJOSInfo.IsServer);
DisplayItem('IsWin32s', TPJOSInfo.IsWin32s);
DisplayItem('IsWin9x', TPJOSInfo.IsWin9x);
DisplayItem('IsWinNT', TPJOSInfo.IsWinNT);
DisplayItem('IsWow64', TPJOSInfo.IsWow64);
DisplayItem('MajorVersion', TPJOSInfo.MajorVersion);
DisplayItem('MinorVersion', TPJOSInfo.MinorVersion);
DisplayItem('Platform', TPJOSInfo.Platform);
DisplayItem('Product', TPJOSInfo.Product);
DisplayItem('ProductID', TPJOSInfo.ProductID);
DisplayItem('ProductName', TPJOSInfo.ProductName);
DisplayItem('ServicePack', TPJOSInfo.ServicePack);
DisplayItem('ServicePackMajor', TPJOSInfo.ServicePackMajor);
DisplayItem('ServicePackMinor', TPJOSInfo.ServicePackMinor);
DisplayRuleOff;
end;
procedure TDemoForm.ShowTPJSysInfo;
begin
DisplayHeading('TPJSysInfo Properties ** deprecated **');
DisplayRuling;
DisplayItem('ComputerName', PJSysInfo1.ComputerName);
DisplayItem('UserName', PJSysInfo1.UserName);
DisplayRuling;
DisplayItem('CommonFilesFolder', PJSysInfo1.CommonFilesFolder);
DisplayItem('ProgramFilesFolder', PJSysInfo1.ProgramFilesFolder);
DisplayItem('SystemFolder', PJSysInfo1.SystemFolder);
DisplayItem('TempFolder', PJSysInfo1.TempFolder);
DisplayItem('WindowsFolder', PJSysInfo1.WindowsFolder);
DisplayRuling;
DisplayItem('OSBuildNumber', PJSysInfo1.OSBuildNumber);
DisplayItem('OSDesc', PJSysInfo1.OSDesc);
DisplayItem('OSMajorVersion', PJSysInfo1.OSMajorVersion);
DisplayItem('OSMinorVersion', PJSysInfo1.OSMinorVersion);
DisplayItem('OSPlatform', PJSysInfo1.OSPlatform);
DisplayItem('OSProduct', PJSysInfo1.OSProduct);
DisplayItem('OSProductName', PJSysInfo1.OSProductName);
DisplayItem('OSProductType', PJSysInfo1.OSProductType);
DisplayItem('OSServicePack', PJSysInfo1.OSServicePack);
DisplayRuleOff;
end;
procedure TDemoForm.ShowTPJSystemFolders;
begin
DisplayHeading('TPJSystemFolders Static Methods');
DisplayRuling;
DisplayItem('CommonFiles', TPJSystemFolders.CommonFiles);
DisplayItem('ProgramFiles', TPJSystemFolders.ProgramFiles);
DisplayItem('System', TPJSystemFolders.System);
DisplayItem('Temp', TPJSystemFolders.Temp);
DisplayItem('Windows', TPJSystemFolders.Windows);
DisplayRuleOff;
end;
procedure TDemoForm.ShowWin32Globals;
begin
DisplayHeading('SysUtils Win32XXX Variables');
DisplayRuling;
DisplayItem('Win32Platform', Win32Platform);
DisplayItem('Win32MajorVersion', Win32MajorVersion);
DisplayItem('Win32MinorVersion', Win32MinorVersion);
DisplayItem('Win32BuildNumber', Win32BuildNumber);
DisplayItem('Win32CSDVersion', Win32CSDVersion);
DisplayRuleOff;
DisplayHeading('PJSysInfo Win32XXX Variables');
DisplayRuling;
DisplayItem('Win32HaveExInfo', Win32HaveExInfo);
DisplayItem('Win32ProductType', Win32ProductType);
DisplayItem('Win32ServicePackMajor', Win32ServicePackMajor);
DisplayItem('Win32ServicePackMinor', Win32ServicePackMinor);
DisplayItem('Win32SuiteMask', Win32SuiteMask);
DisplayRuleOff;
end;
procedure TDemoForm.TabControl1Change(Sender: TObject);
begin
ShowContent(TabControl1.TabIndex);
end;
end.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -