function GetOSInfo: string;
var
Platform: string;
BuildNumber: integer;
begin
case Win32MajorVersion of
3: //NT 3.51
Platform := 'Windows NT 3.51';
4: // Win9x/ME/NT 4
case Win32MinorVersion of
0: Platform := 'Windows 95';
10: Platform := 'Windows 98';
90: Platform := 'Windows ME';
else if (Win32Platform and VER_PLATFORM_WIN32_NT) <> 0 then
Platform := 'Windows NT 4.0'
else
Platform := 'SUnknown';
end; // Win32MinorVersion }
5: //Win2K/XP
case Win32MinorVersion of
0: Platform := 'Windows 2000';
1: Platform := 'Windows XP or .NET server';
else Platform := 'SUnknown';
end;{ Win32MinorVersion }
else Platform := 'SUnknown';
end; // Win32MajorVersion
case Win32Platform of
VER_PLATFORM_WIN32_WINDOWS : BuildNumber := Win32BuildNumber and $0000FFFF;
VER_PLATFORM_WIN32_NT : BuildNumber := Win32BuildNumber;
else
BuildNumber := 0;
end; // Win32Platform
if (Win32Platform = VER_PLATFORM_WIN32_WINDOWS) or (Win32Platform = VER_PLATFORM_WIN32_NT) then
begin
if Win32CSDVersion = '' then
Result := Format('%s (Build %d)', [Platform, BuildNumber])
else
Result := Format('%s (Build %d: %s)', [Platform, BuildNumber, Win32CSDVersion]);
end
else
Result := Platform;
end;
TForm1 = class(TForm)
Button1: TButton;
procedure Button1Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.DFM}
function WinOpSys: TOperatingSystem;
var
Win95, Win98, WinNT, Win2K, WinXP : boolean;
begin
Win95 := (Win32MajorVersion = 4) and (Win32MinorVersion = 0)
and (Win32Platform = VER_PLATFORM_WIN32_WINDOWS);
Win98 := (Win32MajorVersion = 4) and (Win32MinorVersion = 10)
and (Win32Platform = VER_PLATFORM_WIN32_WINDOWS);
WinNT := (Win32MajorVersion = 4) and (Win32MinorVersion = 0)
and (Win32Platform = VER_PLATFORM_WIN32_NT);
WinXP := (Win32MajorVersion = 5) and (Win32MinorVersion = 1)
and (Win32Platform = VER_PLATFORM_WIN32_NT);
Win2K := (Win32MajorVersion = 5) and (Win32MinorVersion = 0)
and (Win32Platform = VER_PLATFORM_WIN32_NT);
Result := osUnknown; // default
if Win95 then
Result := osWin95
else if Win98 then
Result := osWin98
else if WinNT then
Result := osWinNT
else if WinXP then
Result := osWinXP
else if Win2k then
Result := osWin2K;
end;
procedure TForm1.Button1Click(Sender: TObject);
var
WinVer : TOperatingSystem;
begin
WinVer := WinOpSys;
case WinVer of
osUnknown : ShowMessage('알수없어요');
osWin95 : ShowMessage('Win95');
osWin98 : ShowMessage('win98');
osWinNT : ShowMessage('WinNT');
osWin2K : ShowMessage('Win2K');
osWinXP : ShowMessage('WinXp');
end;
end;
var
Platform: string;
BuildNumber: integer;
begin
case Win32MajorVersion of
3: //NT 3.51
Platform := 'Windows NT 3.51';
4: // Win9x/ME/NT 4
case Win32MinorVersion of
0: Platform := 'Windows 95';
10: Platform := 'Windows 98';
90: Platform := 'Windows ME';
else if (Win32Platform and VER_PLATFORM_WIN32_NT) <> 0 then
Platform := 'Windows NT 4.0'
else
Platform := 'SUnknown';
end; // Win32MinorVersion }
5: //Win2K/XP
case Win32MinorVersion of
0: Platform := 'Windows 2000';
1: Platform := 'Windows XP or .NET server';
else Platform := 'SUnknown';
end;{ Win32MinorVersion }
else Platform := 'SUnknown';
end; // Win32MajorVersion
case Win32Platform of
VER_PLATFORM_WIN32_WINDOWS : BuildNumber := Win32BuildNumber and $0000FFFF;
VER_PLATFORM_WIN32_NT : BuildNumber := Win32BuildNumber;
else
BuildNumber := 0;
end; // Win32Platform
if (Win32Platform = VER_PLATFORM_WIN32_WINDOWS) or (Win32Platform = VER_PLATFORM_WIN32_NT) then
begin
if Win32CSDVersion = '' then
Result := Format('%s (Build %d)', [Platform, BuildNumber])
else
Result := Format('%s (Build %d: %s)', [Platform, BuildNumber, Win32CSDVersion]);
end
else
Result := Platform;
end;