線上訂房服務-台灣趴趴狗聯合訂房中心
發文 回覆 瀏覽次數:1061
推到 Plurk!
推到 Facebook!

請問該如何修正宣告順序 ?

答題得分者是:wameng
pcboy
版主


發表:177
回覆:1838
積分:1463
註冊:2004-01-13

發送簡訊給我
#1 引用回覆 回覆 發表時間:2004-09-29 10:48:26 IP:210.69.xxx.xxx 未訂閱
Unit2 的 function GetOSVersionInfo(var Info: TOSVersionInfoEx): Boolean; 這行必須註解掉, 不然會有一堆錯誤, 請問該如何修正宣告順序, 讓它宣告正常, 謝謝!    Unit1.pas 如下    
 
unit Unit1;    interface    uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, StdCtrls,
  Unit2;    type
  TForm1 = class(TForm)
    Memo1: TMemo;
    procedure FormCreate(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;    var
  Form1: TForm1;    implementation    {$R *.dfm}    procedure TForm1.FormCreate(Sender: TObject);
begin
  Memo1.Clear;
  Memo1.Lines.Add('GetOperatingSystem : ' IntToStr(GetOperatingSystem));
  Memo1.Lines.Add('');
  Memo1.Lines.Add('GetOSVersionText : ' GetOSVersionText);
end;    end.
Unit2.pas 如下
 
unit Unit2;    interface    uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, StdCtrls;    //  function GetOSVersionInfo(var Info: TOSVersionInfoEx): Boolean;
  function GetOSVersionText: string;
  function GetOperatingSystem: Integer;
  function IsWin2000: Boolean;
  function IsWin95: Boolean;
  function IsWinME: Boolean;
  function IsWinNT2: Boolean;
  function IsWinNT: Boolean;
  function IsXP: Boolean;    implementation    //Get the Windows Version?    const
  { operating system (OS)constants }
  cOsUnknown = -1; 
  cOsWin95 = 0; 
  cOsWin98 = 1; 
  cOsWin98SE = 2; 
  cOsWinME = 3; 
  cOsWinNT = 4; 
  cOsWin2000 = 5; 
  cOsXP = 6;     function GetOperatingSystem: Integer; 
var 
  osVerInfo: TOSVersionInfo; 
  majorVer, minorVer: Integer; 
begin 
  Result := cOsUnknown;
  { set operating system type flag }
  osVerInfo.dwOSVersionInfoSize := SizeOf(TOSVersionInfo); 
  if GetVersionEx(osVerInfo) then 
  begin
    majorVer := osVerInfo.dwMajorVersion;
    minorVer := osVerInfo.dwMinorVersion; 
    case osVerInfo.dwPlatformId of 
      VER_PLATFORM_WIN32_NT: { Windows NT/2000 } 
        begin 
          if majorVer <= 4 then 
            Result := cOsWinNT 
          else if (majorVer = 5) and (minorVer = 0) then 
            Result := cOsWin2000 
          else if (majorVer = 5) and (minorVer = 1) then 
            Result := cOsXP 
          else 
            Result := cOsUnknown; 
        end; 
      VER_PLATFORM_WIN32_WINDOWS:  { Windows 9x/ME } 
        begin 
          if (majorVer = 4) and (minorVer = 0) then
            Result := cOsWin95 
          else if (majorVer = 4) and (minorVer = 10) then 
          begin 
            if osVerInfo.szCSDVersion[1] = 'A' then 
              Result := cOsWin98SE 
            else
              Result := cOsWin98; 
          end 
          else if (majorVer = 4) and (minorVer = 90) then 
            Result := cOsWinME 
          else 
            Result := cOsUnknown; 
        end; 
      else 
        Result := cOsUnknown; 
    end;
  end 
  else
    Result := cOsUnknown; 
end;    {************************************************}
{ Some useful functions                          } 
{************************************************}     function IsXP: Boolean; 
var 
  OS: TOSVERSIONINFO; 
begin
  OS.dwOSVersionInfoSize := SizeOf(TOSVERSIONINFO); 
  GetVersionEx(OS);
  Result := (OS.dwPlatformId = VER_PLATFORM_WIN32_NT) and 
    (OS.dwMajorVersion = 5) and (OS.dwMinorVersion = 1); 
end;     function IsWin2000: Boolean; 
var 
  OS: TOSVersionInfo; 
begin 
  ZeroMemory(@OS, SizeOf(OS));
  OS.dwOSVersionInfoSize := SizeOf(OS); 
  GetVersionEx(OS); 
  Result := (OS.dwMajorVersion >= 5) and 
    (OS.dwPlatformId = VER_PLATFORM_WIN32_NT); 
end;     function IsWinNT: Boolean;
var 
  OS: TOSVersionInfo; 
begin 
  ZeroMemory(@OS, SizeOf(OS));
  OS.dwOSVersionInfoSize := SizeOf(OS); 
  GetVersionEx(OS); 
  Result := OS.dwPlatformId = VER_PLATFORM_WIN32_NT; 
end;     { or: }     function IsWinNT2: Boolean;
begin 
  Result := Win32Platform = VER_PLATFORM_WIN32_NT; 
end;     function IsWinME: Boolean; 
var 
  OS: TOSVersionInfo; 
begin 
  ZeroMemory(@OS, SizeOf(OS)); 
  OS.dwOSVersionInfoSize := SizeOf(OS); 
  GetVersionEx(OS); 
  Result := (OS.dwMajorVersion = 4) and (OS.dwMinorVersion = 90) and 
    (OS.dwPlatformId = VER_PLATFORM_WIN32_WINDOWS); 
end;    function IsWin95: Boolean; 
var 
  OS: TOSVersionInfo;
begin 
  ZeroMemory(@OS, SizeOf(OS)); 
  OS.dwOSVersionInfoSize := SizeOf(OS); 
  GetVersionEx(OS); 
  Result := (OS.dwMajorVersion >= 4) and (OS.dwMinorVersion = 0) and 
    (OS.dwPlatformId = VER_PLATFORM_WIN32_WINDOWS); 
end;     {************************************************} 
{ Function to detect OS Version by Nico Bendlin  } 
{************************************************}     {$IFDEF CONDITIONALEXPRESSIONS} 
  {$IF Defined(TOSVersionInfoEx)} 
    {$DEFINE TOSVERSIONINFOEX_DEFINED} 
  {$IFEND} 
{$ENDIF}
{$IFNDEF TOSVERSIONINFOEX_DEFINED}     type 
  POSVersionInfoEx = ^TOSVersionInfoEx; 
  TOSVersionInfoEx = packed record 
    dwOSVersionInfoSize: DWORD; 
    dwMajorVersion     : DWORD; 
    dwMinorVersion     : DWORD; 
    dwBuildNumber      : DWORD; 
    dwPlatformId       : DWORD; 
    szCSDVersion       : array [0..127] of AnsiChar; 
    wServicePackMajor  : Word; 
    wServicePackMinor  : Word; 
    wSuiteMask         : Word; 
    wProductType       : Byte; 
    wReserved          : Byte; 
  end;     const 
  VER_SERVER_NT                       = $80000000; 
  {$EXTERNALSYM VER_SERVER_NT} 
  VER_WORKSTATION_NT                  = $40000000;
  {$EXTERNALSYM VER_WORKSTATION_NT}
  VER_SUITE_SMALLBUSINESS             = $00000001; 
  {$EXTERNALSYM VER_SUITE_SMALLBUSINESS} 
  VER_SUITE_ENTERPRISE                = $00000002; 
  {$EXTERNALSYM VER_SUITE_ENTERPRISE} 
  VER_SUITE_BACKOFFICE                = $00000004; 
  {$EXTERNALSYM VER_SUITE_BACKOFFICE} 
  VER_SUITE_COMMUNICATIONS            = $00000008; 
  {$EXTERNALSYM VER_SUITE_COMMUNICATIONS} 
  VER_SUITE_TERMINAL                  = $00000010; 
  {$EXTERNALSYM VER_SUITE_TERMINAL} 
  VER_SUITE_SMALLBUSINESS_RESTRICTED  = $00000020; 
  {$EXTERNALSYM VER_SUITE_SMALLBUSINESS_RESTRICTED} 
  VER_SUITE_EMBEDDEDNT                = $00000040; 
  {$EXTERNALSYM VER_SUITE_EMBEDDEDNT} 
  VER_SUITE_DATACENTER                = $00000080; 
  {$EXTERNALSYM VER_SUITE_DATACENTER} 
  VER_SUITE_SINGLEUSERTS              = $00000100; 
  {$EXTERNALSYM VER_SUITE_SINGLEUSERTS} 
  VER_SUITE_PERSONAL                  = $00000200;
  {$EXTERNALSYM VER_SUITE_PERSONAL} 
  VER_SUITE_BLADE                     = $00000400; 
  {$EXTERNALSYM VER_SUITE_BLADE} 
  VER_SUITE_EMBEDDED_RESTRICTED       = $00000800;
  {$EXTERNALSYM VER_SUITE_EMBEDDED_RESTRICTED} 
  VER_SUITE_SECURITY_APPLIANCE        = $00001000; 
  {$EXTERNALSYM VER_SUITE_SECURITY_APPLIANCE}     const 
  VER_NT_WORKSTATION              = $0000001; 
  {$EXTERNALSYM VER_NT_WORKSTATION} 
  VER_NT_DOMAIN_CONTROLLER        = $0000002; 
  {$EXTERNALSYM VER_NT_DOMAIN_CONTROLLER} 
  VER_NT_SERVER                   = $0000003; 
  {$EXTERNALSYM VER_NT_SERVER}     {$ENDIF}  // TOSVERSIONINFOEX_DEFINED     function GetOSVersionInfo(var Info: TOSVersionInfoEx): Boolean;
begin 
  FillChar(Info, SizeOf(TOSVersionInfoEx), 0); 
  Info.dwOSVersionInfoSize := SizeOf(TOSVersionInfoEx); 
  Result := GetVersionEx(TOSVersionInfo(Addr(Info)^)); 
  if (not Result) then 
  begin 
    FillChar(Info, SizeOf(TOSVersionInfoEx), 0);
    Info.dwOSVersionInfoSize := SizeOf(TOSVersionInfoEx); 
    Result := GetVersionEx(TOSVersionInfo(Addr(Info)^)); 
    if (not Result) then 
      Info.dwOSVersionInfoSize := 0; 
  end; 
end;     function GetOSVersionText: string; 
var 
  Info: TOSVersionInfoEx; 
  Key: HKEY; 
begin 
  Result := '';
  if (not GetOSVersionInfo(Info)) then 
    Exit; 
  case Info.dwPlatformId of 
    { Win32s } 
    VER_PLATFORM_WIN32s: 
      Result := 'Microsoft Win32s'; 
    { Windows 9x } 
    VER_PLATFORM_WIN32_WINDOWS: 
      if (Info.dwMajorVersion = 4) and (Info.dwMinorVersion = 0) then 
      begin
        Result := 'Microsoft Windows 95'; 
        if (Info.szCSDVersion[1] in ['B', 'C']) then 
          Result := Result  ' OSR2'; 
      end 
      else if (Info.dwMajorVersion = 4) and (Info.dwMinorVersion = 10) then 
      begin 
        Result := 'Microsoft Windows 98';
        if (Info.szCSDVersion[1] = 'A') then
          Result := Result   ' SE'; 
      end
      else if (Info.dwMajorVersion = 4) and (Info.dwMinorVersion = 90) then 
        Result := 'Microsoft Windows Millennium Edition'; 
    { Windows NT } 
    VER_PLATFORM_WIN32_NT: 
      begin 
        { Version } 
        if (Info.dwMajorVersion = 5) and (Info.dwMinorVersion = 2) then 
          Result := 'Microsoft Windows Server 2003' 
        else if (Info.dwMajorVersion = 5) and (Info.dwMinorVersion = 1) then 
          Result := 'Microsoft Windows XP' 
        else if (Info.dwMajorVersion = 5) and (Info.dwMinorVersion = 0) then 
          Result := 'Microsoft Windows 2000' 
        else
          Result := 'Microsoft Windows NT'; 
        { Extended } 
        if (Info.dwOSVersionInfoSize >= SizeOf(TOSVersionInfoEx)) then 
        begin 
          { ProductType } 
          if (Info.wProductType = VER_NT_WORKSTATION) then 
          begin
            if (Info.dwMajorVersion = 4) then 
              Result := Result   #10' Workstation 4.0'
            else if(Info.wSuiteMask and VER_SUITE_PERSONAL <> 0) then
              Result := Result   #10' Home Edition'
            else
              Result := Result   #10' Professional';
          end
          else if (Info.wProductType = VER_NT_SERVER) then
          begin
             if (Info.dwMajorVersion = 5) and (Info.dwMinorVersion = 2) then
             begin
               if (Info.wSuiteMask and VER_SUITE_DATACENTER <> 0) then
                 Result := Result   #10' Datacenter Edition'
               else if (Info.wSuiteMask and VER_SUITE_ENTERPRISE <> 0) then
                 Result := Result   #10' Enterprise Edition'
               else if (Info.wSuiteMask = VER_SUITE_BLADE) then
                 Result := Result   #10' Web Edition'
               else
                 Result := Result   #10' Standard Edition';
             end
             else if (Info.dwMajorVersion = 5) and (Info.dwMinorVersion = 0) then
             begin
               if (Info.wSuiteMask and VER_SUITE_DATACENTER <> 0) then
                  Result := Result   #10' Datacenter Server'
               else if (Info.wSuiteMask and VER_SUITE_ENTERPRISE <> 0) then
                  Result := Result   #10' Advanced Server'
               else
                  Result := Result   #10' Server';
             end
             else
             begin
               Result := Result   #10' Server '  
                 IntToStr(Info.dwMajorVersion)   '.'  
                 IntToStr(Info.dwMinorVersion);
               if (Info.wSuiteMask and VER_SUITE_ENTERPRISE <> 0) then
                 Result := Result   ', Enterprise Edition';
             end;
          end;
        end;
        { CSDVersion }
        if (Info.dwMajorVersion = 4) and 
          (StrIComp(Info.szCSDVersion, 'Service Pack 6') = 0) and 
          (RegOpenKeyEx(HKEY_LOCAL_MACHINE, 
            'SOFTWARE\Microsoft\Windows NT\CurrentVersion\Hotfix\Q246009', 0, 
            KEY_QUERY_VALUE, Key) = ERROR_SUCCESS) then 
        begin 
          Result := Result   #10' Service Pack 6a'; 
          RegCloseKey(Key); 
        end 
        else 
          Result := Result   #10   StrPas(Info.szCSDVersion); 
        Result := Result   #10'( Build '  
          IntToStr(Info.dwBuildNumber and $FFFF)   ')';
      end;
  end; 
end;     end.    
------
能力不足,求助於人;有能力時,幫幫別人;如果您滿意答覆,請適時結案!

子曰:問有三種,不懂則問,雖懂有疑則問,雖懂而想知更多則問!
wameng
版主


發表:31
回覆:1336
積分:1188
註冊:2004-09-16

發送簡訊給我
#2 引用回覆 回覆 發表時間:2004-09-29 11:08:31 IP:61.222.xxx.xxx 未訂閱
unit Unit2; interface uses Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs, StdCtrls; {************************************************} { Function to detect OS Version by Nico Bendlin } {************************************************} {$IFDEF CONDITIONALEXPRESSIONS} {$IF Defined(TOSVersionInfoEx)} {$DEFINE TOSVERSIONINFOEX_DEFINED} {$IFEND} {$ENDIF} {$IFNDEF TOSVERSIONINFOEX_DEFINED} type POSVersionInfoEx = ^TOSVersionInfoEx; TOSVersionInfoEx = packed record dwOSVersionInfoSize: DWORD; dwMajorVersion : DWORD; dwMinorVersion : DWORD; dwBuildNumber : DWORD; dwPlatformId : DWORD; szCSDVersion : array [0..127] of AnsiChar; wServicePackMajor : Word; wServicePackMinor : Word; wSuiteMask : Word; wProductType : Byte; wReserved : Byte; end; const VER_SERVER_NT = $80000000; {$EXTERNALSYM VER_SERVER_NT} VER_WORKSTATION_NT = $40000000; {$EXTERNALSYM VER_WORKSTATION_NT} VER_SUITE_SMALLBUSINESS = $00000001; {$EXTERNALSYM VER_SUITE_SMALLBUSINESS} VER_SUITE_ENTERPRISE = $00000002; {$EXTERNALSYM VER_SUITE_ENTERPRISE} VER_SUITE_BACKOFFICE = $00000004; {$EXTERNALSYM VER_SUITE_BACKOFFICE} VER_SUITE_COMMUNICATIONS = $00000008; {$EXTERNALSYM VER_SUITE_COMMUNICATIONS} VER_SUITE_TERMINAL = $00000010; {$EXTERNALSYM VER_SUITE_TERMINAL} VER_SUITE_SMALLBUSINESS_RESTRICTED = $00000020; {$EXTERNALSYM VER_SUITE_SMALLBUSINESS_RESTRICTED} VER_SUITE_EMBEDDEDNT = $00000040; {$EXTERNALSYM VER_SUITE_EMBEDDEDNT} VER_SUITE_DATACENTER = $00000080; {$EXTERNALSYM VER_SUITE_DATACENTER} VER_SUITE_SINGLEUSERTS = $00000100; {$EXTERNALSYM VER_SUITE_SINGLEUSERTS} VER_SUITE_PERSONAL = $00000200; {$EXTERNALSYM VER_SUITE_PERSONAL} VER_SUITE_BLADE = $00000400; {$EXTERNALSYM VER_SUITE_BLADE} VER_SUITE_EMBEDDED_RESTRICTED = $00000800; {$EXTERNALSYM VER_SUITE_EMBEDDED_RESTRICTED} VER_SUITE_SECURITY_APPLIANCE = $00001000; {$EXTERNALSYM VER_SUITE_SECURITY_APPLIANCE} const VER_NT_WORKSTATION = $0000001; {$EXTERNALSYM VER_NT_WORKSTATION} VER_NT_DOMAIN_CONTROLLER = $0000002; {$EXTERNALSYM VER_NT_DOMAIN_CONTROLLER} VER_NT_SERVER = $0000003; {$EXTERNALSYM VER_NT_SERVER} {$ENDIF} // TOSVERSIONINFOEX_DEFINED function GetOSVersionInfo(var Info: TOSVersionInfoEx): Boolean; function GetOSVersionText: string; function GetOperatingSystem: Integer; function IsWin2000: Boolean; function IsWin95: Boolean; function IsWinME: Boolean; function IsWinNT2: Boolean; function IsWinNT: Boolean; function IsXP: Boolean; implementation //Get the Windows Version? const { operating system (OS)constants } cOsUnknown = -1; cOsWin95 = 0; cOsWin98 = 1; cOsWin98SE = 2; cOsWinME = 3; cOsWinNT = 4; cOsWin2000 = 5; cOsXP = 6; function GetOperatingSystem: Integer; var osVerInfo: TOSVersionInfo; majorVer, minorVer: Integer; begin Result := cOsUnknown; { set operating system type flag } osVerInfo.dwOSVersionInfoSize := SizeOf(TOSVersionInfo); if GetVersionEx(osVerInfo) then begin majorVer := osVerInfo.dwMajorVersion; minorVer := osVerInfo.dwMinorVersion; case osVerInfo.dwPlatformId of VER_PLATFORM_WIN32_NT: { Windows NT/2000 } begin if majorVer <= 4 then Result := cOsWinNT else if (majorVer = 5) and (minorVer = 0) then Result := cOsWin2000 else if (majorVer = 5) and (minorVer = 1) then Result := cOsXP else Result := cOsUnknown; end; VER_PLATFORM_WIN32_WINDOWS: { Windows 9x/ME } begin if (majorVer = 4) and (minorVer = 0) then Result := cOsWin95 else if (majorVer = 4) and (minorVer = 10) then begin if osVerInfo.szCSDVersion[1] = 'A' then Result := cOsWin98SE else Result := cOsWin98; end else if (majorVer = 4) and (minorVer = 90) then Result := cOsWinME else Result := cOsUnknown; end; else Result := cOsUnknown; end; end else Result := cOsUnknown; end; {************************************************} { Some useful functions } {************************************************} function IsXP: Boolean; var OS: TOSVERSIONINFO; begin OS.dwOSVersionInfoSize := SizeOf(TOSVERSIONINFO); GetVersionEx(OS); Result := (OS.dwPlatformId = VER_PLATFORM_WIN32_NT) and (OS.dwMajorVersion = 5) and (OS.dwMinorVersion = 1); end; function IsWin2000: Boolean; var OS: TOSVersionInfo; begin ZeroMemory(@OS, SizeOf(OS)); OS.dwOSVersionInfoSize := SizeOf(OS); GetVersionEx(OS); Result := (OS.dwMajorVersion >= 5) and (OS.dwPlatformId = VER_PLATFORM_WIN32_NT); end; function IsWinNT: Boolean; var OS: TOSVersionInfo; begin ZeroMemory(@OS, SizeOf(OS)); OS.dwOSVersionInfoSize := SizeOf(OS); GetVersionEx(OS); Result := OS.dwPlatformId = VER_PLATFORM_WIN32_NT; end; { or: } function IsWinNT2: Boolean; begin Result := Win32Platform = VER_PLATFORM_WIN32_NT; end; function IsWinME: Boolean; var OS: TOSVersionInfo; begin ZeroMemory(@OS, SizeOf(OS)); OS.dwOSVersionInfoSize := SizeOf(OS); GetVersionEx(OS); Result := (OS.dwMajorVersion = 4) and (OS.dwMinorVersion = 90) and (OS.dwPlatformId = VER_PLATFORM_WIN32_WINDOWS); end; function IsWin95: Boolean; var OS: TOSVersionInfo; begin ZeroMemory(@OS, SizeOf(OS)); OS.dwOSVersionInfoSize := SizeOf(OS); GetVersionEx(OS); Result := (OS.dwMajorVersion >= 4) and (OS.dwMinorVersion = 0) and (OS.dwPlatformId = VER_PLATFORM_WIN32_WINDOWS); end; function GetOSVersionInfo(var Info: TOSVersionInfoEx): Boolean; begin FillChar(Info, SizeOf(TOSVersionInfoEx), 0); Info.dwOSVersionInfoSize := SizeOf(TOSVersionInfoEx); Result := GetVersionEx(TOSVersionInfo(Addr(Info)^)); if (not Result) then begin FillChar(Info, SizeOf(TOSVersionInfoEx), 0); Info.dwOSVersionInfoSize := SizeOf(TOSVersionInfoEx); Result := GetVersionEx(TOSVersionInfo(Addr(Info)^)); if (not Result) then Info.dwOSVersionInfoSize := 0; end; end; function GetOSVersionText: string; var Info: TOSVersionInfoEx; Key: HKEY; begin Result := ''; if (not GetOSVersionInfo (Info)) then Exit; case Info.dwPlatformId of { Win32s } VER_PLATFORM_WIN32s: Result := 'Microsoft Win32s'; { Windows 9x } VER_PLATFORM_WIN32_WINDOWS: if (Info.dwMajorVersion = 4) and (Info.dwMinorVersion = 0) then begin Result := 'Microsoft Windows 95'; if (Info.szCSDVersion[1] in ['B', 'C']) then Result := Result ' OSR2'; end else if (Info.dwMajorVersion = 4) and (Info.dwMinorVersion = 10) then begin Result := 'Microsoft Windows 98'; if (Info.szCSDVersion[1] = 'A') then Result := Result ' SE'; end else if (Info.dwMajorVersion = 4) and (Info.dwMinorVersion = 90) then Result := 'Microsoft Windows Millennium Edition'; { Windows NT } VER_PLATFORM_WIN32_NT: begin { Version } if (Info.dwMajorVersion = 5) and (Info.dwMinorVersion = 2) then Result := 'Microsoft Windows Server 2003' else if (Info.dwMajorVersion = 5) and (Info.dwMinorVersion = 1) then Result := 'Microsoft Windows XP' else if (Info.dwMajorVersion = 5) and (Info.dwMinorVersion = 0) then Result := 'Microsoft Windows 2000' else Result := 'Microsoft Windows NT'; { Extended } if (Info.dwOSVersionInfoSize >= SizeOf(TOSVersionInfoEx)) then begin { ProductType } if (Info.wProductType = VER_NT_WORKSTATION) then begin if (Info.dwMajorVersion = 4) then Result := Result #10' Workstation 4.0' else if(Info.wSuiteMask and VER_SUITE_PERSONAL <> 0) then Result := Result #10' Home Edition' else Result := Result #10' Professional'; end else if (Info.wProductType = VER_NT_SERVER) then begin if (Info.dwMajorVersion = 5) and (Info.dwMinorVersion = 2) then begin if (Info.wSuiteMask and VER_SUITE_DATACENTER <> 0) then Result := Result #10' Datacenter Edition' else if (Info.wSuiteMask and VER_SUITE_ENTERPRISE <> 0) then Result := Result #10' Enterprise Edition' else if (Info.wSuiteMask = VER_SUITE_BLADE) then Result := Result #10' Web Edition' else Result := Result #10' Standard Edition'; end else if (Info.dwMajorVersion = 5) and (Info.dwMinorVersion = 0) then begin if (Info.wSuiteMask and VER_SUITE_DATACENTER <> 0) then Result := Result #10' Datacenter Server' else if (Info.wSuiteMask and VER_SUITE_ENTERPRISE <> 0) then Result := Result #10' Advanced Server' else Result := Result #10' Server'; end else begin Result := Result #10' Server ' IntToStr(Info.dwMajorVersion) '.' IntToStr(Info.dwMinorVersion); if (Info.wSuiteMask and VER_SUITE_ENTERPRISE <> 0) then Result := Result ', Enterprise Edition'; end; end; end; { CSDVersion } if (Info.dwMajorVersion = 4) and (StrIComp(Info.szCSDVersion, 'Service Pack 6') = 0) and (RegOpenKeyEx(HKEY_LOCAL_MACHINE, 'SOFTWARE\Microsoft\Windows NT\CurrentVersion\Hotfix\Q246009', 0, KEY_QUERY_VALUE, Key) = ERROR_SUCCESS) then begin Result := Result #10' Service Pack 6a'; RegCloseKey(Key); end else Result := Result #10 StrPas(Info.szCSDVersion); Result := Result #10'( Build ' IntToStr(Info.dwBuildNumber and $FFFF) ')'; end; end; end; end. 把 TOSVersionInfoEx 宣告移到上面 就可以了
系統時間:2024-11-23 11:43:35
聯絡我們 | Delphi K.Top討論版
本站聲明
1. 本論壇為無營利行為之開放平台,所有文章都是由網友自行張貼,如牽涉到法律糾紛一切與本站無關。
2. 假如網友發表之內容涉及侵權,而損及您的利益,請立即通知版主刪除。
3. 請勿批評中華民國元首及政府或批評各政黨,是藍是綠本站無權干涉,但這裡不是政治性論壇!