API GetVersionEx in MSDN !!!
解决方案 »
- 不好意思再问一个组件编程问题!
- 使用UPD控件编写一个DLL文件出错,请各位高手帮忙(急)
- Delphi中使用.net写的webservice所返回的Dataset类
- dbgrid1中第一列是datetime,我想不人工输入(这样没法控制输入的是日期),想从MonthCalendar1选择日期的值,怎么做才能实现呢?
- 在自己的软件里面怎么实行Code Complete功能啊!
- 如何打印报表
- 急~
- 如何利用程序实现将SQLSERVER7.0的数据在某一设定时间中进行数据备份(不用SQL自带的Maintenance Plan)
- delphi控制Excel自定义属性
- **** 50 分**** 怎么把十六进制的UNICODE转换成STRING
- 我子窗体不显示,这是怎么一回事?
- 在DELPHI中内嵌汇编,有什么好的书或资料介绍吗,最有好网址
Windows, Messages, SysUtils, Dialogs, Registry;type
SystemInfoRecord = record
// Os
Version: string;
Plattform: string;
// Processor
ProcOemId: word;
ProcNum: word;
ProcType: string;
ProcVers: string;
// Memory
MemTotal: Dword;
MemAvailable: Dword;
MemUsage: Dword;
SwapFileSetting: Dword;
SwapFileSize: Dword;
SwapFileUsage: Dword;
// Registration
UserName: string;
CompanyName: string;
SerialNo: string;
// Language ID's
SystemDefLangID: string;
UserDefLangID: string;
end;var
SystemInfoRec: SystemInfoRecord;
PlattformId: Dword; // used in other routines
CurRegKey: PChar;
procedure GetAllSystemInfo;
implementation
{-------------------------------------------------------------------------------
}
function Plat(Pl: DWORD): string;
begin
case Pl of
VER_PLATFORM_WIN32s: result := 'Win32s on Windows 3.1x';
VER_PLATFORM_WIN32_WINDOWS: result := 'Windows 95/98';
VER_PLATFORM_WIN32_NT: result := 'Windows NT';
else result := 'Unknow';
end;
end;
{-------------------------------------------------------------------------------
}
procedure GetAllSystemInfo;
var OS: TOSVersionInfo;
SI: TSystemInfo;
MS: TMemoryStatus;
begin
with SystemInfoRec do begin // get win plattform & version
with OS do begin
dwOSVersionInfoSize := SizeOf(TOSVersionInfo);
if GetVersionEx(OS) then begin
Version := Format('%d.%d (%d.%s)',[dwMajorVersion, dwMinorVersion,
(dwBuildNumber and $FFFF), szCSDVersion]);
Plattform := Plat(dwPlatformId);
PlattformId := dwPlatformId;
end;
end; // with OS // get processor type & info
with SI do begin
GetSystemInfo(SI);
ProcOemId := dwOemId;
ProcNum := dwNumberOfProcessors; case dwProcessorType of
386 : ProcType := ' 386';
486 : ProcType := ' 486';
586 : ProcType := ' Pentium';
4000 : ProcType := ' MIPS Risc 4000';
21064: ProcType := ' ALPHA';
end;
ProcVers := Format('Level %d Rev. %d.%d',
[wProcessorLevel, hi(wProcessorRevision), lo(wProcessorRevision)]);
end; // with SI // Get memory status & dim
with MS do begin
dwLength := sizeof(TMemoryStatus);
GlobalMemoryStatus(MS); MemTotal := dwTotalPhys;
MemAvailable := dwAvailPhys;
MemUsage := 100-trunc(dwAvailPhys/dwTotalPhys*100);
SwapFileSetting := dwTotalPageFile;
SwapFileSize := dwTotalPageFile-dwAvailPageFile;
SwapFileUsage := 100-trunc(dwAvailPageFile/dwTotalPageFile*100);
end; // with MS // get registration info
case PlattformId of
VER_PLATFORM_WIN32_WINDOWS :
CurRegKey := '\SOFTWARE\Microsoft\Windows\CurrentVersion';
VER_PLATFORM_WIN32_NT :
CurRegKey := '\SOFTWARE\Microsoft\Windows NT\CurrentVersion';
else CurRegKey := nil;
end;
with TRegistry.Create do
try
RootKey := HKEY_LOCAL_MACHINE;
if OpenKey(CurRegKey, False) then begin
UserName := ReadString('RegisteredOwner');
CompanyName := ReadString('RegisteredOrganization');
SerialNo := ReadString('ProductID');
end; // if
finally
Free;
end; // try
SystemDefLangID := Format('$%.4x',[GetSystemDefaultLangID]);
UserDefLangID := Format('$%.4x',[GetUserDefaultLangID]);
end; // SystemInfoRec
end;
还有侦测处理器信息,怎么办?