인터넷에서 누군가 작성한 코드를 바탕으로 버전업했습니다
테스트 해보시고 문제가 있으시다면 알려주세요
아직 Windows 7에서만 테스트 했습니다.
procedure TMainForm.SpeedButton_Win_verClick(Sender: TObject);
var
osInfo: OSVERSIONINFOEX;
ver :string;
begin
osInfo.dwOSVersionInfoSize:=sizeof(OSVERSIONINFOEX);
if GetVersionEx(osInfo) then
begin
with osinfo do
begin
case dwPlatformId of
VER_PLATFORM_WIN32_NT: //Windows NT/2000/XP/7/8/10
begin
case dwMajorVersion of
0..4 : ver := 'Windows NT';
5 : begin
if (dwMinorVersion = 0) then
ver := 'Windows 2000'
else
if (dwMinorVersion = 1) then
ver := 'Windows XP'
else
if (dwMinorVersion = 2) then
begin
if GetSystemMetrics(SM_SERVERR2) <> 0 then
ver := 'Windows Server 2003 R2'
else
if GetSystemMetrics(SM_SERVERR2) = 0 then
ver := 'Windows Server 2003';
end;
end;
6 : begin
if (dwMinorVersion = 0) then
begin
if (wProductType = VER_NT_WORKSTATION) then
ver := 'Windows Vista'
else
if (wProductType <> VER_NT_WORKSTATION) then
ver := 'Windows 2008'
end
else
if (dwMinorVersion = 1) then
begin
if (wProductType = VER_NT_WORKSTATION) then
ver := 'Windows 7'
else
if (wProductType <> VER_NT_WORKSTATION) then
ver := 'Windows 2008 R2'
end
else
if (dwMinorVersion = 2) then
begin
if (wProductType = VER_NT_WORKSTATION) then
ver := 'Windows 8'
else
if (wProductType <> VER_NT_WORKSTATION) then
ver := 'Windows 2012'
end
else
if (dwMinorVersion = 3) then
begin
if (wProductType = VER_NT_WORKSTATION) then
ver := 'Windows 8.1'
else
if (wProductType <> VER_NT_WORKSTATION) then
ver := 'Windows 2012 R2'
end;
end;
10 : begin
if (dwMinorVersion = 0) then
begin
if (wProductType = VER_NT_WORKSTATION) then
ver := 'Windows 10'
else
if (wProductType <> VER_NT_WORKSTATION) then
ver := 'Windows 2016 Technical Preview';
end;
end;
end;
end;
VER_PLATFORM_WIN32_WINDOWS: //Windows 9x/ME
begin
if (dwMajorVersion =4) and (dwMinorVersion =0) then
ver := 'Windows 95'
else if (dwMajorVersion =4) and (dwMinorVersion =10) then
begin
if szCSDVersion[1] = 'A' then
ver := 'Windows 98SE'
else
ver := 'Windows 98';
end
else if (dwMajorVersion =4) and (dwMinorVersion =90) then
ver := 'Windows ME'
else
ver :='Unknown';
end;
else
ver := 'Unknown';
end; //case
end; //with
end
else
ver := 'Unknown';
showmessage(ver);
end;
|
https://www.delmadang.com/community/bbs_view.asp?bbsNo=3&page=&bbsCat=&st=&keyword=&indx=449232
위의 링크로 가면 정확한 버전 확인 방법을 적어놓았습니다.