主页 > 编程资料 > Delphi >
发布时间:2015-09-22 作者:网络 阅读:112次

Delphi2007编译的时候去掉GetVersionExA(@VI)中的@

function GetWindowsVersionString: AnsiString;
var
VI: TOSVersionInfoA;
begin
VI.dwOSVersionInfoSize :
= SizeOf(TOSVersionInfoA);
if GetVersionExA(@VI) then
with VI do
Result :
= Trim(
Format(
'%d.%d build %d %s',
[dwMajorVersion, dwMinorVersion, dwBuildNumber, szCSDVersion]
)
)
else
Result :
= '';
end;

function GetWindowsVersion: String; //读取操作系统版本
var
AWin32Version: Extended;
os:
string;
begin
os:
='Windows ';
AWin32Version :
= StrtoFloat(format('%d.%d' ,[Win32MajorVersion, Win32MinorVersion]));
if Win32Platform=VER_PLATFORM_WIN32s then
Result :
= os + '32'
else if Win32Platform=VER_PLATFORM_WIN32_WINDOWS then
begin
if AWin32Version=4.0 then
Result :
= os + '95'
else if AWin32Version=4.1 then
Result :
= os + '98'
else if AWin32Version=4.9 then
Result :
= os + 'Me'
else
Result :
= os + '9x'
end
else if Win32Platform = VER_PLATFORM_WIN32_NT then
begin
if AWin32Version=3.51 then
Result :
= os + 'NT 3.51'
else if AWin32Version=4.0 then
Result :
= os + 'NT 4.0'
else if AWin32Version=5.0 then
Result :
= os + '2000'
else if AWin32Version=5.1 then
Result :
= os + 'XP'
else if AWin32Version=5.2 then
Result :
= os + '2003'
else if AWin32Version=6.0 then
Result :
= os + 'Vista'
else if AWin32Version=6.1 then
Result :
= os + '7'
else
Result :
= os ;
end
else
Result :
= os + '??';
Result:
=Result + ' '+GetWIndowsVersionString;
end;

关键字词: