function GetOSVer: integer ;
var
vi: _OSVERSIONINFO;
begin
Result:=osUnknow;
FillChar(vi, SizeOf(vi), 0);
vi.dwOSVersionInfoSize := SizeOf(vi);
Windows.GetVersionEx(vi);
if (Win32Platform=1) then begin
if (Win32MinorVersion=0) then begin
Result:=osWin95;
end else begin
Result:=osWin98;
end;
end else if (Win32Platform=2) then begin
if (Win32MajorVersion=4) then begin
Result:=osWinNT
end else if (Win32MajorVersion=5) then begin
if (Win32MinorVersion=0) then begin
Result:=osWin2K;
end else if (Win32MinorVersion=1) begin
Result:=osWinXP;
end else begin
Result:=osVista;
end;
end;
end;
end;
參考網址:
http://www.ge.net.tw/?q=node/919