Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/ms-access/4.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Ms access 使用注册表检测office 365(access)和Visual C 64x_Ms Access_Visual C++_Installation_Inno Setup_Pascalscript - Fatal编程技术网

Ms access 使用注册表检测office 365(access)和Visual C 64x

Ms access 使用注册表检测office 365(access)和Visual C 64x,ms-access,visual-c++,installation,inno-setup,pascalscript,Ms Access,Visual C++,Installation,Inno Setup,Pascalscript,我有一个MS Access应用程序,我计划出售给人们,但它使用ODBC(MYSQL)连接到后端MYSQL DB plus显然需要MS Access(至少在运行时) 我创建了一个Inno安装程序来检查已安装的组件,但是我遇到了一些问题: 除非还安装了ODBC 32x,否则ODBC 64x将失败 ODBC(或)不能安装除非各自的VisualC++ Visual+2015-2019安装 我的Visual C+注册表路径检测到安装,但检测不到位版本 使用我当前的注册表检测方法未检测到Ms Access

我有一个MS Access应用程序,我计划出售给人们,但它使用ODBC(MYSQL)连接到后端MYSQL DB plus显然需要MS Access(至少在运行时)

我创建了一个Inno安装程序来检查已安装的组件,但是我遇到了一些问题:

  • 除非还安装了ODBC 32x,否则ODBC 64x将失败
  • ODBC(或)不能安装除非各自的VisualC++ Visual+2015-2019安装
  • 我的Visual C+注册表路径检测到安装,但检测不到位版本
  • 使用我当前的注册表检测方法未检测到Ms Access 365(2019?)
  • 使用的代码:

    function GetHKLM: Integer;
    begin
      if IsWin64 then
        Result := HKLM64
      else
        Result := HKLM32;
    
      Result := HKLM;
    end;
    
    function IsOfficeInstalled: Boolean;
    begin
      Result := RegKeyExists(GetHKLM, 'Software\Microsoft\Office');
    end;
    
    function NormalAccessPath: String;
    var
      Names: TArrayOfString;
      I: Integer;
      S: String;   
    begin
      if not IsOfficeInstalled then
          Result:=''
      else
      begin
        if RegGetSubkeyNames(GetHKLM, 'Software\Microsoft\Office', Names) then
        begin
          for I := 0 to GetArrayLength(Names)-1 do
            begin
              S := 'Software\Microsoft\Office\' + Names[I]+ '\' + 'Access';
              if RegKeyExists(GetHKLM, S) then
                Result:=S;
              S := '';
            end
        end    
      end;
    end;
    
    function IsNormalAccessInstalled: Boolean;
    var
      Path: String;
    begin
        Path:= NormalAccessPath;
        if Path <> '' then
          Result := True
        else
          Result := False
    end;
    
    
    
    function IsMySQLODBC51Installed: Boolean;
    begin
    
      // the result was inverted in the original code; the original function returned
      // True if the ODBC driver was not installed, False otherwise, and according to
      // the function name it should be vice-versa
      Result := RegKeyExists(GetHKLM, 'Software\ODBC\ODBCINST.INI\MySQL ODBC 8.0 Unicode Driver');
    end;
    
    
    
    function IsRuntimeAccessInstalled: Boolean;
    begin
    
      Result := RegKeyExists(GetHKLM, 'Software\Microsoft\Windows\CurrentVersion\Uninstall\AccessRuntimeRetail - en-us');
    
    
    
    end;
    
    function IsVCInstalled: Boolean;
    begin
    
      Result := RegKeyExists(GetHKLM, 'Software\Microsoft\VisualStudio\14.0\VC');
    
    
    
    end;
    
    function AddAsTrusted: Boolean;
    var
      Path: String;
      ResultCode: Integer;
    begin
        Path:= NormalAccessPath;
    
        MsgBox('Adding Trusted Location', mbInformation, MB_OK);
    
        //Exec('C:\Me\freelance\Inno setup script\fixes.bat', '', '', SW_SHOW, ewWaitUntilTerminated, ResultCode)
        if Path <> '' then
          begin
            //if not RegKeyExists(GetHKLM, Path + '\Security') then
            //  RegWriteStringValue(GetHKLM, Path + '\Security','MedidropUseless', 'MedidropUseless')
            if not RegKeyExists(GetHKLM, Path + '\Security\Trusted Locations') then
              RegWriteStringValue(GetHKLM, Path + '\Security\Trusted Locations\Location1','Path', 'C:\MediDrop')  
          end;  
    
      Result := True;
    end;
    
    这是不合适的

    对于4: 可以看出,我正在检查Software\Microsoft\Office,但是这台计算机确实有15.0和16.0子文件夹(术语?),但没有访问它们,因此我的安装程序认为它没有安装

    然而。。是的,所以我需要找到一种方法来找到这个365版本的access

    最后,在安装结束时,我添加了受信任位置的路径:

    function AddAsTrusted: Boolean;
    var
      Path: String;
      ResultCode: Integer;
    begin
        Path:= NormalAccessPath;
    
        MsgBox('Adding Trusted Location', mbInformation, MB_OK);
    
        //Exec('C:\Me\freelance\Inno setup script\fixes.bat', '', '', SW_SHOW, ewWaitUntilTerminated, ResultCode)
        if Path <> '' then
          begin
            if not RegKeyExists(GetHKLM, Path + '\Security\Trusted Locations') then
              RegWriteStringValue(GetHKLM, Path + '\Security\Trusted Locations\Location1','Path', 'C:\[MyAppName]')  
          end;  
    
      Result := True;
    end;
    
    函数AddAsTrusted:Boolean;
    变量
    路径:字符串;
    结果代码:整数;
    开始
    路径:=NormalAccessPath;
    MsgBox('添加受信任位置',MB信息,MB_OK);
    //Exec('C:\Me\Freeline\Inno setup script\fixes.bat','','',SW_SHOW,EWWaitUnFilterminated,ResultCode)
    如果路径为“”,则
    开始
    如果不存在注册表项(GetHKLM,Path+'\Security\Trusted Locations),则
    RegWriteStringValue(GetHKLM,路径+“\Security\Trusted Locations\Location1”,“路径”,“C:\[MyAppName]”)
    结束;
    结果:=真;
    结束;
    
    再次由于365问题。。。这不起作用。我在16.0中正确地创建了路径,但由于access不存在,所以在第一次打开应用程序时,我仍然需要启用内容,这是我不想做的


    有人知道我可以从哪里着手解决上述问题吗?

    @MartynA我使用ODBC连接到云mysql数据库。这不对吗?@MartynA抱歉,我会编辑的。是,MS access前端与Mysql后端
    function AddAsTrusted: Boolean;
    var
      Path: String;
      ResultCode: Integer;
    begin
        Path:= NormalAccessPath;
    
        MsgBox('Adding Trusted Location', mbInformation, MB_OK);
    
        //Exec('C:\Me\freelance\Inno setup script\fixes.bat', '', '', SW_SHOW, ewWaitUntilTerminated, ResultCode)
        if Path <> '' then
          begin
            if not RegKeyExists(GetHKLM, Path + '\Security\Trusted Locations') then
              RegWriteStringValue(GetHKLM, Path + '\Security\Trusted Locations\Location1','Path', 'C:\[MyAppName]')  
          end;  
    
      Result := True;
    end;