2020-02-25

【Delphi7】取得 Windows 版本資訊

 
var
    ver: TOSVersionInfo;
begin
    ver.dwOSVersionInfoSize := SizeOf(ver);
    if GetVersionEx(ver) then
        with ver do
            label1.Caption := IntToStr(dwMajorVersion) + '.' + IntToStr(dwMinorVersion) + '.' + IntToStr(dwBuildNumber) + ' (' + szCSDVersion + ')'
            // 5.1.2600 -- XP(Service Pack 3)
            // 6.1.7601 -- Win7(Service Pack 1)
            // 6.2.9200 -- Win10()