我想在Windows 10操作系统上安装VB6。我需要处理VBP项目,所以我必须无缝地安装VB6

时间:2016-07-03 11:05:30

标签: visual-studio vb6 windows-10

我已经设置了VB6企业版,但无法完成安装。(挂)
我从以下链接尝试过安装程序: http://nuke.vbcorner.net/Tools/VisualStudio6Installer/tabid/93/language/it-IT/Default.aspx

上面安装的条件你需要准备msdn图像文件,我没有。如何在Windows 10上安装VB6?

7 个答案:

答案 0 :(得分:8)

我按照here的说明为Windows 10创建VB 6和VB6 SP6安装程序。

创建简单,快速,无问题地工作。

答案 1 :(得分:2)

This应该适合您,但请确保您仔细阅读所有注释,因为零字节文件似乎已停止在以后的构建中工作,因此其他人共享了一些变通方法。老实说,如果它所做的只是停止重启,我不明白为什么这很重要。复制主要文本,以防有一天链接消失。

  

停止重新启动

     

正如我之前在Windows 7和Windows 8上安装VB6的教程一样,您将要创建一个名为MSJAVA.DLL的零字节文件。在C:\ Windows中创建此文件将阻止在安装结束时重新启动。如果您不熟悉如何创建零字节文件,只需单击该链接即可。

     

让我们开始

     

插入安装媒体后,您首先注意到的是程序兼容性助手,其中会出现已知兼容性问题的警告。关闭它 - 我们需要手动运行安装程序。如果您关闭了自动运行功能,则在运行安装程序时会弹出此选项。

     

导航到安装媒体,然后找到安装程序。右键单击setup.exe,然后选择“以管理员身份运行”。很重要!安装程序需要做一些注册表,并在Windows上注册一些项目,并且没有必要的权限就无法完成。

     

只需单击“读取运行程序而不获取帮助”选项,即可启动主设置向导。

     

前几个屏幕是常见的东西,你以前见过的东西:

     
      
  • 欢迎屏幕 - 让您有机会阅读自述文件。只是   点击下一步,除非你真的想读它!
  •   
  • EULA - 是的,它是最终用户许可协议。然后滚动它   在相应的单选按钮中发出接受信号,然后单击   下一步。
  •   
  • 产品编号和用户ID - 这是您输入用户名的位置,   公司名称和产品ID。按照您认为合适的方式填写字段   单击“下一步”继续向导。
  •   
  • 安装什么 - 这里有两个选项; VB6企业版或服务器   应用。我将使用第一个选项
  •   
  • Common Installation文件夹 - 我接受了默认设置:   C:\ Program Files(x86)\ Microsoft Visual Studio \ Common
  •   
  • 欢迎和警告 - 版权保护,无法更新文件   在使用中等。单击继续继续
  •   
  • Visual Basic 6.0企业设置 - 这是实际的   VB6的安装开始了。您的PID显示在屏幕上,而您   如果你还没有,请它写下来。单击“确定”   继续
  •   
     

主要安装

     

在ACM设置的第一个屏幕上,将安装文件夹保留为默认值,然后单击“自定义”选项进行设置。下一个屏幕将是选项列表。

     

我没有使用SourceSafe,所以我清除了复选框。如果您使用SourceSafe,那么请务必检查安装。

     

非常重要(编者按:最后看评论) - 清除数据访问的复选框。如果您不这样做,设置将在安装结束时挂起。不确定真正的原因,但理论是设置试图在不存在的服务上注册Windows。清除“数据访问”复选框会停止此注册尝试。

     

单击“继续”继续安装过程。此时,如果您没有在C:\ Windows中创建空的MSJAVA.DLL文件,则会重新启动Windows提示符。如果需要,请继续重启,我等一下。

     

无论如何,您将获得MSDN安装向导。我拒绝这一点,因为无论如何都可以在线获得更多信息。

     

现在,您将获得一个选项“服务器设置”对话框。如果要安装BackOffice,Visual SourceSafe Server或SNA服务器,此时您将有机会。我没有使用这些项目,所以我只需点击“下一步”就可以了。

     

最后,我们进入向导的最后一个屏幕。取消选中立即注册复选框,然后单击完成。

     

让VB6首次运行

     

您可以在常用的Microsoft Visual Basic 6.0程序组下的开始菜单中找到新的快捷方式。你可能想要立即开火,你可以。但是,您将收到有关自动化的错误信息,访问注册表时出错。你可以解决这个错误,但是你每次启动VB6时都会不断获取它,并且一些与数据访问相关的项目无法正常工作。

     

因此,要解决此问题,请右键单击开始菜单组中的Microsoft Visual Basic 6.0程序图标,然后选择“以管理员身份运行”。在生成的UAC对话框中单击是,VB6将正常启动,显示新项目向导。

     

好的,第一个安装后任务已完成。现在进入最后一块。

     

修复IDE Chug

     

现在,在开始构建新项目或编辑现有项目之前,您可能需要进行一些配置。在Windows 10虚拟机中运行IDE时,我发现在调整和/或在表单上放置控件时IDE会有些迟缓,以及调整表单本身的大小。这个问题也出现在Windows 7和Windows 8中。我们需要配置一些关于IDE运行属性的东西来解决这个问题。

     

确保IDE已关闭,然后再次右键单击开始菜单图标。这次选择打开文件位置。

     

在出现的资源管理器窗口中,右键单击Microsoft Visual Basic 6.0图标,然后选择属性。在“属性”窗口中,选择“兼容性”选项卡。在“兼容性”选项卡上,单击“更改所有用户的设置”按钮。

     

在新的VB6属性窗口中,在兼容模式下运行此程序中选中勾选复选框,然后从下拉列表中选择Windows XP(Service Pack 3)。

     

在“设置”下,选中“缩减颜色模式”复选框,然后将下拉列表更改为16位(65536)颜色。

     

勾选高DPI设置时禁用显示缩放。

     

单击“确定”,然后再次单击“确定”。

使用数据访问安装(自2016年7月3日起的最后评论)

  

我成功安装了Visual Studio 6 Professional   Windows 10 Pro 64位数据访问。这很简单,只是   像往常一样安装VS6,启用数据访问,它会   尝试完成安装时冻结。然后允许它冻结   结束安装任务。您仍将拥有所有安装文件   并将能够运行该程序。现在,您需要安装   VB6服务包6,但它不允许你从视觉工作室   没有正确安装。要解决此问题,请再次安装VS6   时间取消选中数据访问组件,正常安装。之后,   运行服务包,你应该很高兴。

答案 2 :(得分:1)

用于安装VB6编程IDE和MSDN库的VB6安装程序向导Visual Studio 6.0 Installer wizard已下载超过175,000次。

您需要拥有VB6或VS6 CD和VB6序列号。

它适用于Windows 7、8.x或10 32位或64位。

答案 3 :(得分:0)

我通过跟踪互联网上的许多帖子得到VS6 / VB6在Windows 10下运行,包括1)降低UAC + REGEDIT检查,2)从VS安装磁盘1 IE4文件夹复制真正的MSJAVA.DLL(un-7- Zip MSJAVX86.EXE)将MSJAVA.DLL拖动到所有Windows SYSTEM32 / SYSWOW64文件夹(零字节MSJAVA.DLL不再有效),3)放置和REGSVR32&#dx7vb.dll(与前一步骤在同一文件夹中) ,然后使用MSCONFIG以安全模式启动Win10,并从原始MSDN CD运行安装。 [没有CD?继续阅读]

对于VB6,您只需要DISC 1,MSDN CD和Service Pack 6(在Internet上获取)。警告:DISC 1的安装将变为"无响应"。在我的情况下,一小时后,我认为它必须完成,所以让Win10关闭它作为一个"没有响应的窗口",它继续使用MSDN并且它工作。 (您也可以稍后从CD安装MSDN独立版)如果您无法使SP6更新正常工作,请尝试将其放在根目录中的Thumbdrive上并调用卷名称VS6SP6。实际上,对于VB6,如果您不再拥有CD,则可以使用每个安装文件夹的内容创建CD,前提是您提供CD卷标名称,如下所示:

VB6光盘1卷标:VSP600ENU1

VB6 Disc 3卷标:DN600ENU1

VB6 Disc 4卷标:DN600ENU2

完成后,将MSCONFIG恢复到正常启动状态,然后重新启动UAC。

一个小故障,我还没有解决。 " .HLP" Windows 10不支持文件,因此不会提供VB6帮助(即MSDN)。但是,我已经读过(但没试过)我可以将WINHLP32.EXE从XP机器复制到Win10 Windows目录。但首先,我必须让旧的XP机器运行。

现在,我正在Windows 10家庭版下重新开发所有我的VB程序(没有HELP工具),并且欢快地再次编译!

希望这有帮助。

答案 4 :(得分:0)

更新我上面关于帮助工具的帖子。即使我使用CD安装了MSDN Library并从XP机器复制了一个旧的winhlp32.exe,这使我能够从Win10中查看“.HLP”文件,但是从VB6中查找没有任何帮助。最后,我能够访问该网站并下载vshelp.exe。

http://download.cnet.com/Visual-Studio-Help-Engine-for-MSDN-Enables-MSDN-menu-functionality-in-Visual-FoxPro/3000-2213_4-10727794.html

它快速运行并使所有Visual Studio / Visual Basic 6.0帮助工作,包括上下文相关帮助。

答案 5 :(得分:0)

Microsoft对VB6编程环境的支持声明在此处... VB6 support statement

答案 6 :(得分:0)

我不久前制作了这个脚本,因为我在互联网上找到的安装程序和修复程序有问题。它将我在互联网上找到的所有技巧和技巧整合到一个 Powershell 脚本中。

要运行脚本,您需要执行以下操作:

上面的每一个都应该放在自己的文件夹中。如果您在包含这三个文件夹的文件夹中保存(然后点源)脚本,它将为您自动检测所有内容。您还可以将您在 powershell 中的当前位置设置为该文件夹,并将脚本直接复制到您的会话中,它也会检测到所有内容。

一旦脚本被点源化或粘贴到提升的 powershell 实例中,您就可以通过调用 Install-VB6 来运行它。

如果您想覆盖任何默认行为,它还具有以下参数:

<头>
参数 类型 用法
Vb6InstallerPath 字符串 主 VB6 安装程序文件夹的路径
SP6InstallerPath 字符串 Service Pack 6 安装程序文件夹的路径
SkipMouseWheel 开关 跳过安装鼠标滚轮固定器文件夹
MouseWheelPath 字符串 鼠标滚轮固定器的路径。如果指定了 -SkipMouseWheel,则忽略
Regsvr32Path 字符串 regsvr32.exe 的路径。如果未指定,则使用“%SYSTEMROOT%\SysWoW64\regsvr32.exe”
RegEditPath 字符串 regedit.exe 的路径。 '%SYSTEMROOT%\regedit.exe' 如果未指定
OrganizationName 字符串 在 VB6 安装程序中设置组织名称

注意事项:

  1. VB6 和 SP6 安装程序不喜欢从网络驱动器运行,因此如果检测到安装文件夹之一不在本地驱动器上,脚本将停止。
  2. 我只在 VB6 Pro 上测试过,没有在 VB6 Enterprise 上测试过。
  3. 它不安装 MSDN。

安装-VB6.ps1

#Requires -RunAsAdministrator
#Requires -Version 3

<#
.SYNOPSIS
Installs VB6 to the computer.

.DESCRIPTION
Installs VB6 ide with Service Pack 6 and (optional) Mouse Wheel Fix to the local computer.

.PARAMETER Vb6InstallerPath
The path to the VB6 installer folder.

.PARAMETER SP6InstallerPath
The path the the Service Pack 6 installer folder.

.PARAMETER SkipMouseWheel
Skip installing the Mouse Wheel fix.

.PARAMETER MouseWheelPath
The path the Mouse wheel fix folder.

.PARAMETER Regsvr32Path
The path to RegSvr32.exe

.PARAMETER OrganizationName
The organization name

.PARAMETER RegEditPath
The path to regedit.exe
#>
Function Install-VB6{
    [CmdletBinding()]
    param (
        [Parameter(Mandatory=$false)]
        [string]$Vb6InstallerPath,
        [Parameter(Mandatory=$false)]
        [string]$SP6InstallerPath,
        [Parameter(Mandatory=$false)]
        [switch]$SkipMouseWheel,
        [Parameter(Mandatory=$false)]
        [string]$MouseWheelPath,
        [Parameter(Mandatory=$false)]
        [string]$Regsvr32Path,
        [Parameter(Mandatory=$false)]
        [string]$OrganizationName,
        [Parameter(Mandatory=$false)]
        [string]$RegEditPath
    )


    # Tests if the path is a local path. The installer doesn't like network paths.
    function Test-LocalDrive{
        [CmdletBinding()]
        [OutputType([bool])]
        param(
            [Parameter(Mandatory=$true,
                        Position=0)]
            [string]$Path
        )
        begin{
            $localDrives = Get-WmiObject -Class Win32_logicaldisk -Filter "DriveType<>4" -Property "DeviceID" | Foreach-Object {$_.DeviceID.Replace(":", "")}
        }
        process{
            if(!([bool](Test-Path -Path $Path))){
                return $false
            }

            $item = Get-Item -Path $Path
            $drive = $item.PSDrive

            if($null -eq $drive){
                return $false
            }

            return ($localDrives -contains $drive.Name)
        }
    }

    function Search-ForFile{
        [CmdletBinding()]
        [OutputType([System.IO.FileInfo])]
        param(
            [Parameter(Mandatory=$true,
                        Position=0)]
            [string]$File,
            [Parameter(Mandatory=$true,
                        Position=1)]
            [string]$CurrentLocation,
            [switch]$IncludeSubDirectory
        )
        process{
            $newPath = $currentLocation
            if($IncludeSubDirectory.IsPresent){
                $newPath = Join-Path -Path $newPath -ChildPath "*"
            }
            $newPath = Join-Path -Path $newPath -ChildPath $file

            $item = @(Get-Item -Path $newPath)

            if($null -eq $item -or $item.Count -eq 0 -or $null -eq $item[0]){
                throw ("Could Not find the {0} file." -f $file)
            }

            return $item[0]
        }
    }

    

#region Setting Up File Paths
    $currentLocation = $PSScriptRoot
    if([System.String]::IsNullOrWhiteSpace($currentLocation)){
        $currentLocation = (Get-Location)
    }
    if([System.String]::IsNullOrWhiteSpace($currentLocation)){
        throw "Unable to determine current location"
    }

    if(!$PSBoundParameters.ContainsKey("Vb6InstallerPath") -or [System.String]::IsNullOrWhiteSpace($Vb6InstallerPath)){
        if(!(Test-LocalDrive -Path ($currentLocation))){
            Write-Error "The script cannot be ran from a network share."
            Write-Host -NoNewLine 'Press any key to continue...';
            $null = $Host.UI.RawUI.ReadKey('NoEcho,IncludeKeyDown');
            return
        }
        $installerInfo = Search-ForFile -File "SETUP.EXE" -CurrentLocation $currentLocation -IncludeSubDirectory
        $installFolder = $installerInfo.DirectoryName
    }
    else {
        if(!(Test-LocalDrive -Path ($Vb6InstallerPath))){
            Write-Error "The VB6 Installer Path cannot be a share."
            Write-Host -NoNewLine 'Press any key to continue...';
            $null = $Host.UI.RawUI.ReadKey('NoEcho,IncludeKeyDown');
            return
        }
        $installFolder = $Vb6InstallerPath
        $installerInfo = Search-ForFile -File "SETUP.EXE" -CurrentLocation $installFolder
    }

    $installer2Info = Search-ForFile -File "ACMSETUP.EXE" -CurrentLocation $installFolder -IncludeSubDirectory

    $installLocation = $installerInfo.FullName
    $install2Location = $installer2Info.FullName

    if(!$PSBoundParameters.ContainsKey("SP6InstallerPath") -or [System.String]::IsNullOrWhiteSpace($SP6InstallerPath)){
        if(!(Test-LocalDrive -Path ($currentLocation))){
            Write-Error "The script cannot be ran from a network share."
            Write-Host -NoNewLine 'Press any key to continue...';
            $null = $Host.UI.RawUI.ReadKey('NoEcho,IncludeKeyDown');
            return
        }
        $SP6Info = Search-ForFile -File "setupsp6.exe" -CurrentLocation $currentLocation -IncludeSubDirectory
        $SP6Folder = $SP6Info.DirectoryName
    }
    else {
        if(!(Test-LocalDrive -Path ($SP6InstallerPath))){
            Write-Error "The SP6 Installer Path cannot be a network share."
            Write-Host -NoNewLine 'Press any key to continue...';
            $null = $Host.UI.RawUI.ReadKey('NoEcho,IncludeKeyDown');
            return
        }
        $SP6Folder = $SP6InstallerPath
        $SP6Info = Search-ForFile -File "setupsp6.exe" -CurrentLocation $SP6Folder
    }

    $SP6Location = $SP6Info.FullName

    if(!$SkipMouseWheel.IsPresent){
        if(!$PSBoundParameters.ContainsKey("MouseWheelPath") -or [System.String]::IsNullOrWhiteSpace($MouseWheelPath)){
            if(!(Test-LocalDrive -Path ($currentLocation))){
                Write-Error "The script cannot be ran from a network share."
                Write-Host -NoNewLine 'Press any key to continue...';
                $null = $Host.UI.RawUI.ReadKey('NoEcho,IncludeKeyDown');
                return
            }
            $MouseWheelDllInfo           = Search-ForFile -File "VB6IDEMouseWheelAddin.dll" -CurrentLocation $currentLocation -IncludeSubDirectory
            $MouseWheelRegistryInfo      = Search-ForFile -File "VBA Mouse Wheel Fix.reg" -CurrentLocation $currentLocation -IncludeSubDirectory
        }
        else {
            if(!(Test-LocalDrive -Path ($SP6InstallerPath))){
                Write-Error "The Mouse Wheel Path cannot be a network share."
                Write-Host -NoNewLine 'Press any key to continue...';
                $null = $Host.UI.RawUI.ReadKey('NoEcho,IncludeKeyDown');
                return
            }
            $MouseWheelDllInfo           = Search-ForFile -File "VB6IDEMouseWheelAddin.dll" -CurrentLocation $MouseWheelPath
            $MouseWheelRegistryInfo      = Search-ForFile -File "VBA Mouse Wheel Fix.reg" -CurrentLocation $MouseWheelPath
        }

        $MouseWheelDll           = $MouseWheelDllInfo.FullName
        $MouseWheelRegistry      = $MouseWheelRegistryInfo.FullName
    }

    if(!$PSBoundParameters.ContainsKey("Regsvr32Path") -or [System.String]::IsNullOrWhiteSpace($Regsvr32Path)){
        $regSvrPath = "$($env:systemroot)\SysWoW64\regsvr32.exe"
    }
    else{
        $regSvrPath = $Regsvr32Path
    }

    if(!$PSBoundParameters.ContainsKey("RegEditPath") -or [System.String]::IsNullOrWhiteSpace($RegEditPath)){
        $RegEditPath = "$($env:systemroot)\regedit.exe"
    }
#endregion Setting Up File Paths

#region Test Required Installer Paths Exist

    if(!([bool](Test-Path -Path $regSvrPath))){
        Write-Error ("Unable to find '{0}'.`r`nThe exe must exist." -f $regSvrPath)
        Write-Host -NoNewLine 'Press any key to continue...';
        $null = $Host.UI.RawUI.ReadKey('NoEcho,IncludeKeyDown');
        return
    }

    if(!([bool](Test-Path -Path $RegEditPath))){
        Write-Error ("Unable to find '{0}'.`r`nThe exe must exist." -f $RegEditPath)
        Write-Host -NoNewLine 'Press any key to continue...';
        $null = $Host.UI.RawUI.ReadKey('NoEcho,IncludeKeyDown');
        return
    }

    if(!$SkipMouseWheel.IsPresent){
        if(!([bool](Test-Path -Path $MouseWheelDll))){
            Write-Error ("Unable to find '{0}'.`r`nThe 'MouseWheel' Folder must be in the same directory as the install script and the file must exist." -f $MouseWheelDll)
            Write-Host -NoNewLine 'Press any key to continue...';
            $null = $Host.UI.RawUI.ReadKey('NoEcho,IncludeKeyDown');
            return
        }

        if(!([bool](Test-Path -Path $MouseWheelRegistry))){
            Write-Error ("Unable to find '{0}'.`r`nThe 'MouseWheel' Folder must be in the same directory as the install script and the file must exist." -f $MouseWheelRegistry)
            Write-Host -NoNewLine 'Press any key to continue...';
            $null = $Host.UI.RawUI.ReadKey('NoEcho,IncludeKeyDown');
            return
        }
    }

    if(!([bool](Test-Path -Path $installFolder))){
        Write-Error ("Unable to find '{0}'.`r`nThe 'Installer' Folder must be in the same directory as the install script." -f $installFolder)
        Write-Host -NoNewLine 'Press any key to continue...';
        $null = $Host.UI.RawUI.ReadKey('NoEcho,IncludeKeyDown');
        return
    }

    if(!([bool](Test-Path -Path $installLocation))){
        Write-Error ("Unable to find '{0}'.`r`nThe 'Installer' Folder must be in the same directory as the install script and the file must exist." -f $installLocation)
        Write-Host -NoNewLine 'Press any key to continue...';
        $null = $Host.UI.RawUI.ReadKey('NoEcho,IncludeKeyDown');
        return
    }

    if(!([bool](Test-Path -Path $install2Location))){
        Write-Error ("Unable to find '{0}'.`r`nThe 'Installer' Folder must be in the same directory as the install script and the file must exist." -f $install2Location)
        Write-Host -NoNewLine 'Press any key to continue...';
        $null = $Host.UI.RawUI.ReadKey('NoEcho,IncludeKeyDown');
        return
    }

    if(!([bool](Test-Path -Path $SP6Location))){
        Write-Error ("Unable to find '{0}'.`r`nThe 'SP6' Folder must be in the same directory as the install script and the file must exist." -f $SP6Location)
        Write-Host -NoNewLine 'Press any key to continue...';
        $null = $Host.UI.RawUI.ReadKey('NoEcho,IncludeKeyDown');
        return
    }

#endregion Test Required Installer Paths Exist

#region Installer Compatibility
    # The installer doesn't auto-elevate to run as an administrator.
    # We are setting the required keys in the registry to force the installers to run as administrator
    # Same as running the 'troubleshoot compatibilty' wizard and selecting the exe's to run as admins.
    Write-Host "Setting compatibility mode on setup files."
    $layersPath = "REGISTRY::HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\AppCompatFlags\Layers"
    if(![bool](Test-Path -Path $layersPath)){
        New-Item -Path $layersPath -Force | Out-Null
    }

    $registryPath = Get-Item -LiteralPath $layersPath
    if($null -eq $registryPath.GetValue($installLocation, $null)){
        New-ItemProperty -Path $layersPath -Name $installLocation -Value "^ WINXPSP3" -PropertyType "String" -Force | Out-Null
    }

    if($null -eq $registryPath.GetValue($SP6Location, $null)){
        New-ItemProperty -Path $layersPath -Name $SP6Location -Value "^ WINXPSP3" -PropertyType "String" -Force | Out-Null
    }
#endregion Installer Compatibility

#region Previous Install Cleanup
    # Locations and keys where old vb6 installs can live.
    Write-Host "Cleaning up previous install."

    $itemsToDelete = @(
        "C:\Program Files*\Microsoft Visual Studio\Common",
        "C:\Program Files*\Microsoft Visual Studio\MSDN",
        "C:\Program Files*\Microsoft Visual Studio\MSDN98",
        "C:\Program Files*\Microsoft Visual Studio\VB98",
        "C:\Program Files*\Microsoft Visual Studio\VC98",
        "C:\Program Files*\Microsoft Visual Studio\*.HTM",
        "C:\Program Files*\Microsoft Visual Studio\*.TXT",
        "C:\Program Files*\Common Files\Microsoft Shared\MSDesigners98",
        "C:\Program Files*\Common Files\Microsoft Shared\MSDN",
        "C:\Program Files*\Common Files\Microsoft Shared\VS98",
        "C:\Program Files*\Common Files\Microsoft Shared\Wizards98",
        "REGISTRY::HKEY_LOCAL_MACHINE\Software\Microsoft\DevStudio",
        "REGISTRY::HKEY_LOCAL_MACHINE\Software\Microsoft\HTML Help Collections",
        "REGISTRY::HKEY_LOCAL_MACHINE\Software\Microsoft\MSVSDG",
        "REGISTRY::HKEY_LOCAL_MACHINE\Software\Microsoft\Visual Basic\6.0",
        "REGISTRY::HKEY_LOCAL_MACHINE\Software\Microsoft\Visual Component Manager",
        "REGISTRY::HKEY_LOCAL_MACHINE\Software\Microsoft\Visual Modeler",
        "REGISTRY::HKEY_LOCAL_MACHINE\Software\Microsoft\VisualStudio\6.0",
        "REGISTRY::HKEY_LOCAL_MACHINE\Software\Wow6432Node\Microsoft\DevStudio",
        "REGISTRY::HKEY_LOCAL_MACHINE\Software\Wow6432Node\Microsoft\HTML Help Collections",
        "REGISTRY::HKEY_LOCAL_MACHINE\Software\Wow6432Node\Microsoft\MSVSDG",
        "REGISTRY::HKEY_LOCAL_MACHINE\Software\Wow6432Node\Microsoft\Visual Basic\6.0",
        "REGISTRY::HKEY_LOCAL_MACHINE\Software\Wow6432Node\Microsoft\Visual Component Manager",
        "REGISTRY::HKEY_LOCAL_MACHINE\Software\Wow6432Node\Microsoft\Visual Modeler",
        "REGISTRY::HKEY_LOCAL_MACHINE\Software\Wow6432Node\Microsoft\VisualStudio\6.0",
        "REGISTRY::HKEY_CURRENT_USER\Software\Microsoft\DevStudio",
        "REGISTRY::HKEY_CURRENT_USER\Software\Microsoft\MSVSDG",
        "REGISTRY::HKEY_CURRENT_USER\Software\Microsoft\Visual Basic\6.0",
        "REGISTRY::HKEY_CURRENT_USER\Software\Microsoft\Visual Modeler",
        "REGISTRY::HKEY_CURRENT_USER\Software\Microsoft\VisualFoxPro",
        "REGISTRY::HKEY_CURRENT_USER\Software\Microsoft\VisualStudio\6.0"
    )

    $itemsToDelete | Where-Object { Test-Path -Path $_ } | Remove-Item -Force -Recurse | Out-Null
#endregion Previous Install Cleanup

#region Installer Registry Permissions
    # The installer needs to be able to write to 'HKEY_CLASSES_ROOT\RDSServer.DataFactory\Clsid'
    # but since the installer isn't built for windows and we have to force it to run as an administrator
    # we have to give explicit permissions for your computers Administrators group to write to this key (and all its children)
    Write-Host "Setting required permissions for installing user on registry."

    $registryPermissionPath = "REGISTRY::HKEY_CLASSES_ROOT\RDSServer.DataFactory\Clsid"
    Write-Host "`tSetting Up required information."
    $acl = Get-ACL -Path $registryPermissionPath
    $oldOwner = [System.Security.Principal.NTAccount]::new($acl.Owner)
    $administratorIdentity = [System.Security.Principal.NTAccount]::new("Administrators")

    Write-Host "`tGiving the script required permissions."
    $import = '[DllImport("ntdll.dll")] public static extern int RtlAdjustPrivilege(ulong a, bool b, bool c, ref bool d);'
    $ntdll = Add-Type -Member $import -Name NtDll -PassThru
    $privileges = @{ SeTakeOwnership = 9; SeBackup =  17; SeRestore = 18 }
    foreach ($i in $privileges.Values) {
        $null = $ntdll::RtlAdjustPrivilege($i, 1, 0, [ref]0)
    }

    Write-Host "`tGettting The registry key."
    $regKey = [Microsoft.Win32.Registry]::ClassesRoot.OpenSubKey("RDSServer.DataFactory\Clsid", 'ReadWriteSubTree', 'TakeOwnership')

    # We force the Administrators group to be the owner on the key so we can then add required the permissions.
    Write-Host "`tSetting Owner."
    $acl.SetOwner($administratorIdentity)
    $regKey.SetAccessControl($acl)

    Write-Host "`tSetting Permission."
    $permission = [System.Security.AccessControl.RegistryAccessRule]::new($administratorIdentity, "FullControl", "ContainerInherit", "InheritOnly", "Allow")
    $acl.AddAccessRule($permission)
    $permission2 = [System.Security.AccessControl.RegistryAccessRule]::new($administratorIdentity, "FullControl", "Allow")
    $acl.AddAccessRule($permission2)
    $regKey.SetAccessControl($acl)

    # Reset the owner to clean-up
    Write-Host "`tResetting Owner."
    $acl.SetOwner($oldOwner)
    $regKey.SetAccessControl($acl)

#endregion Installer Registry Permissions

#region Install
    Write-Host "`tStarting Install."
    $tempPath = [System.IO.Path]::GetTempPath()
    $tempFolder = Join-Path -Path $tempPath -ChildPath ([System.Guid]::NewGuid().ToString("n"))
    New-Item -Path $tempFolder -ItemType Directory -Force | Out-Null
    $KeyFile = Join-Path -Path $tempFolder -ChildPath ("{0}.dat" -f [System.Guid]::NewGuid().ToString("n"))
    $keyFileText = @"
REGEDIT4

[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\VisualStudio\6.0\Setup\Microsoft Visual Basic\SetupWizard]
"aspo"=dword:00000000

[HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\VisualStudio\6.0\Setup\Microsoft Visual Basic\SetupWizard]
"aspo"=dword:00000000
"@
    $keyFileText | Set-Content -Path $keyFile -Force

    & $RegEditPath /S $KeyFile
    
    [string[]]$installerArguments = ("/T", "VB98PRO.stf", "/S", $installFolder, "/n", ($env:USERNAME), "/k", "0000000000", "/b", "1", "/qn1")

    if($PSBoundParameters.ContainsKey("OrganizationName") -and ![System.String]::IsNullOrWhiteSpace($OrganizationName)){
        $installerArguments += "/o"
        $installerArguments += $OrganizationName
    }
    Start-Process -FilePath $install2Location -wait -NoNewWindow -ArgumentList $installerArguments
    Start-Process -FilePath $SP6Location -wait -NoNewWindow -ArgumentList ("/qn1")

    Write-Host "Setting Vb6 Compatibility"
    $vb6ExeLocations = @(Get-Item -Path "C:\Program Files*\Microsoft Visual Studio\VB98\VB6.EXE" | Select-Object -ExpandProperty FullName)
    $registryPath = Get-Item -LiteralPath $layersPath
    foreach($vb6ExeLocation in $vb6ExeLocations){
        if($null -eq $registryPath.GetValue($vb6ExeLocation, $null)){
            New-ItemProperty -Path $layersPath -Name $vb6ExeLocation -Value "^ WINXPSP3" -PropertyType "String" -Force | Out-Null
        }
    }

    if(!$SkipMouseWheel.IsPresent){

        Write-Host "Installing Mouse Wheel"
        & $regSvrPath /s $MouseWheelDll
        & $RegEditPath /S $MouseWheelRegistry

        $registryHeaderText = @"
Windows Registry Editor Version 5.00


"@

        $registryItemFormat = @"
        [{0}\SOFTWARE\Microsoft\Visual Basic\6.0\Addins\VB6IDEMouseWheelAddin.Connect]
        "FriendlyName"="MouseWheel Fix"
        "LoadBehavior"=dword:00000003
        "CommandLineSafe"=dword:00000000
"@

        $users = Get-ChildItem -Path "REGISTRY::HKEY_USERS" | Where-Object {$_.Name -notlike "*_Classes"} | Select-Object -ExpandProperty Name
        $content = $registryHeaderText

        # Install for every user.
        foreach($user in $users){
            $content += ($registryItemFormat -f $user)
        }

        $MouseWheelApplyRegistry = Join-Path -Path $tempFolder -ChildPath ("{0}.reg" -f [System.Guid]::NewGuid().ToString("n"))

        $content | Set-Content -Path $MouseWheelApplyRegistry -Force
        Start-Process $RegEditPath -wait -NoNewWindow -ArgumentList ("/S", $MouseWheelApplyRegistry)

        Write-Host "You will still need to enable Mouse Wheel fix in the VB6 IDE." -BackgroundColor Black -ForegroundColor Red
        Write-Host "Open a Visual Basic project and go to 'Add-Ins' -> 'Add-In Manager...' " -BackgroundColor Black -ForegroundColor Red
        Write-Host "Select 'MouseWheel Fix' and click 'Loaded/Unloaded' and 'Load on Startup'"  -BackgroundColor Black -ForegroundColor Red
    }

    Remove-Item -Path $tempFolder -Force -Recurse | Out-Null
#endregion Install

    Write-Host "Install Complete"
    Write-Host -NoNewLine 'Press any key to continue...';
    $null = $Host.UI.RawUI.ReadKey('NoEcho,IncludeKeyDown');
}