论坛风格切换切换到宽版
  • 262阅读
  • 2回复

【已解决】安装判断系统类型以及是否已安装(求高手检查哪里出错了) [复制链接]

上一主题 下一主题
离线sinwintter
 

发帖
5
金钱
50
威望
5
只看楼主 倒序阅读 0 发表于: 01-19
在[code]段下,写这两个函数后,能根据不同的系统安装不同的程序,但是不能判断该程序是否已安装。代码如下:
var
  nt5: Boolean;
  nt6: Boolean;
  Version: TWindowsVersion;


function IsNT5(): Boolean;
begin
    Result := nt5;
end;

function IsNT6(): Boolean;
begin
    Result := nt6;
end;

  function InitializeSetup(): Boolean;
  begin
      GetWindowsVersionEx(Version);
    nt5 := False;
    nt6 := False;
    if Version.NTPlatform then begin
        if (Version.Major = 5) then begin
          nt5 := True;
          end;
        if(Version.Major = 6) then begin
          nt6 := True;
          end;
      end;
    Result := True;
  end;

//安装前判断是否已安装
function InitializeSetup2(): Boolean;
    var
    sName: String;
     begin
     Result := True;
     if RegQueryStringValue(HKEY_LOCAL_MACHINE, 'SOFTWARE\XytClient', 'MyAppVerName', sName) then
         if sName = '信易通系统智能维护平台 V0.1' then
             begin
             Result:= False;
             MsgBox('你系统中已经安装了该程序,没必要在安装了。', mbInformation, MB_OK);
            end;
         end;
    end;




在线gnatix

发帖
6912
金钱
7500
威望
750
只看该作者 1 发表于: 01-20
  1. [code]
  2. var
  3.   nt5: Boolean;
  4.   nt6: Boolean;
  5.   Version: TWindowsVersion;
  6. function IsNT5(): Boolean;
  7. begin
  8.   Result := nt5;
  9. end;
  10. function IsNT6(): Boolean;
  11. begin
  12.   Result := nt6;
  13. end;
  14. function InitializeSetup(): Boolean;
  15. var
  16.   sName: String;
  17. begin
  18.   GetWindowsVersionEx(Version);
  19.   nt5 := False;
  20.   nt6 := False;
  21.   if Version.NTPlatform then begin
  22.     if (Version.Major = 5) then begin
  23.       nt5 := True;
  24.       end;
  25.     if(Version.Major = 6) then begin
  26.       nt6 := True;
  27.       end;
  28.     end;
  29.   Result := True;
  30.   if RegQueryStringValue(HKEY_LOCAL_MACHINE, 'SOFTWARE\XytClient', 'MyAppVerName', sName) then
  31.     if sName = '信易通系统智能维护平台 V0.1' then
  32.       begin
  33.         Result:= False;
  34.         MsgBox('你系统中已经安装了该程序,没必要在安装了。', mbInformation, MB_OK);
  35.       end;
  36. end;

离线sinwintter

发帖
5
金钱
50
威望
5
只看该作者 2 发表于: 01-20
回 1楼(gnatix) 的帖子
gnatix:var  nt5: Boolean;  nt6: Boolean;....... (2012-01-20 03:08) 

谢谢虎哥